/* Media feed — MVP (mobile-first, RTL) */
:root {
    --media-primary: #2d5bd1;
    --media-primary-soft: #e8effc;
    --media-bg: #ffffff;
    --media-text: #1a1a1a;
    --media-text-muted: #6b7280;
    --media-border: #eef0f4;
    --media-card-shadow: 0 2px 14px rgba(26, 45, 95, 0.08);
    --media-radius: 16px;
    --media-radius-sm: 12px;
    --media-badge-advanced: #2d5bd1;
    --media-badge-beginner: #22a06b;
    --media-badge-intermediate: #e8a317;
    --media-top-nav-h: 3.5rem;
    --media-header-h: 7.5rem;
    --media-return-context-h: 0px;
    --media-max: 480px;
    --media-feed-desktop: 630px;
}

.media-body [hidden] {
    display: none !important;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

.media-body {
    margin: 0;
    padding: 0;
    font-family: IRANSans, Tahoma, sans-serif;
    background: var(--media-bg);
    color: var(--media-text);
    -webkit-font-smoothing: antialiased;
}

.media-app {
    min-height: 100dvh;
    max-width: 100%;
    margin: 0 auto;
    padding-bottom: 1.25rem;
    background: var(--media-bg);
}

/* ── Header ── */
.media-header {
    position: sticky;
    top: calc(var(--media-top-nav-h) + var(--media-return-context-h));
    z-index: 100;
    background: var(--media-bg);
    padding: 0.65rem 1rem 0.75rem;
    border-bottom: 1px solid var(--media-border);
}

.media-header__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.media-header__logo {
    flex: 1;
    display: flex;
    justify-content: center;
    min-width: 0;
}

.media-header__logo img {
    height: 2.35rem;
    width: auto;
    max-width: 11rem;
    object-fit: contain;
}

.media-header__actions {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.media-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border: none;
    border-radius: 50%;
    background: #f3f4f6;
    color: #4b5563;
    font-size: 1rem;
    text-decoration: none;
    cursor: pointer;
    flex-shrink: 0;
}

.media-icon-btn:hover {
    background: #e8eaef;
    color: var(--media-text);
}

.media-icon-btn--placeholder {
    visibility: hidden;
    pointer-events: none;
}

/* ── Stories ── */
.media-stories {
    padding: 0.85rem 0 0.35rem;
    overflow: hidden;
}

.media-stories__track {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 0 1rem 0.25rem;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.media-stories__track::-webkit-scrollbar {
    display: none;
}

.media-story {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 4.5rem;
    border: none;
    background: none;
    padding: 0;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}

.media-story__trigger {
    display: block;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}

a.media-story--add {
    cursor: pointer;
}

.media-story__ring {
    display: block;
    width: 4.25rem;
    height: 4.25rem;
    padding: 2px;
    border-radius: 50%;
    background: linear-gradient(180deg, #4a7fe8 0%, var(--media-primary) 100%);
    transition: background 0.2s ease, opacity 0.2s ease, filter 0.2s ease;
}

.media-story.is-seen .media-story__ring {
    background: #d7dce5 !important;
    opacity: 0.78;
    filter: saturate(0.35);
}

.media-story.is-seen .media-story__inner img {
    opacity: 0.62;
    filter: grayscale(0.28);
}

.media-story.is-seen .media-story__label {
    color: #9ca3af;
    font-weight: 400;
}

.media-story:not(.is-seen) .media-story__ring {
    background: linear-gradient(180deg, #4a7fe8 0%, var(--media-primary) 100%);
    opacity: 1;
}

.media-story__inner {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
    background: #fff;
    border: 2px solid #fff;
}

.media-story__inner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-story__inner--add {
    background: #f3f4f6;
    color: var(--media-primary);
    font-size: 1.35rem;
}

.media-story--add .media-story__ring {
    background: #d1d9e8;
}

.media-story__label {
    display: block;
    margin-top: 0.4rem;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--media-text);
    text-align: center;
    line-height: 1.35;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

a.media-story__label:hover {
    color: var(--media-primary);
}

/* ── Inline compose (create post) ── */
.media-compose {
    align-self: stretch;
    width: 100%;
    box-sizing: border-box;
    margin: 0 -1rem 0.85rem;
    padding: 0.75rem 1rem 0.85rem;
    border-top: 1px solid var(--media-border);
    border-bottom: 1px solid var(--media-border);
    background: var(--media-bg);
}

@media (min-width: 768px) {
    .media-compose {
        margin-left: 0;
        margin-right: 0;
    }
}

.media-compose__row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.media-compose__avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 999px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--media-primary-soft);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.media-compose__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.media-compose__avatar-fallback {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--media-primary);
}

.media-compose__prompt {
    flex: 1;
    min-width: 0;
    background: #f3f4f6;
    border-radius: 999px;
    padding: 0.55rem 1rem;
    color: var(--media-text-muted);
    font-size: 0.875rem;
    text-decoration: none;
    line-height: 1.4;
}

.media-compose__prompt:hover {
    background: #eef0f4;
    color: var(--media-text-muted);
}

.media-compose__photo {
    flex-shrink: 0;
    color: var(--media-primary);
    font-size: 1.35rem;
    line-height: 1;
    text-decoration: none;
    padding: 0.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.media-compose__photo:hover {
    color: #1e45a8;
}

/* ── Tabs ── */
.media-tabs {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 0;
    padding: 0 0.5rem;
    border-bottom: 1px solid var(--media-border);
    margin-bottom: 0.85rem;
}

.media-tabs__item {
    flex: 1;
    border: none;
    background: none;
    padding: 0.7rem 0.25rem;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--media-text-muted);
    cursor: pointer;
    position: relative;
    white-space: nowrap;
    text-align: center;
    text-decoration: none;
}

.media-tabs__item.is-active {
    color: var(--media-primary);
    font-weight: 700;
}

.media-tabs__item.is-active::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 15%;
    left: 15%;
    height: 3px;
    background: var(--media-primary);
    border-radius: 3px 3px 0 0;
}

.media-card__course-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--media-primary) 12%, transparent);
    color: var(--media-primary);
    font-size: 0.7rem;
    font-weight: 700;
}

.media-card__visual--link {
    display: block;
    color: inherit;
    text-decoration: none;
}

.media-card__footer-caption--course {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 0.65rem;
}

.media-card__course-title {
    display: block;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--media-text);
}

.media-card__course-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    margin: 0 0.75rem 0.75rem;
    width: calc(100% - 1.5rem);
    padding: 0.65rem 0.85rem;
    border-radius: 0.75rem;
    background: var(--media-primary);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none;
}

.media-card__course-cta:hover {
    filter: brightness(0.96);
}

.media-card--course .media-card__footer {
    min-height: 0;
}

/* ── Feed ── */
.media-feed {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 0 1rem 1rem;
}

/* ── Post card ── */
.media-card {
    background: var(--media-bg);
    border-radius: var(--media-radius);
    box-shadow: var(--media-card-shadow);
    border: 1px solid var(--media-border);
    overflow: hidden;
}

.media-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 0.85rem 0.65rem;
}

.media-card__menu {
    border: none;
    background: none;
    color: #9ca3af;
    font-size: 1.1rem;
    padding: 0.25rem;
    cursor: pointer;
    line-height: 1;
}

.media-card__user {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex: 1;
    min-width: 0;
    text-decoration: none;
    color: inherit;
}

.media-card__user:hover .media-card__name {
    color: var(--media-primary);
}

.media-avatar-link {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    min-height: 48px;
    border-radius: 50%;
    text-decoration: none;
}

.media-card__meta {
    color: inherit;
    text-decoration: none;
}

[data-media-avatar-user].has-active-story {
    cursor: pointer;
}

.media-avatar-link.has-active-story,
.media-comment__avatar.has-active-story {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.media-avatar-link.has-active-story.is-story-seen,
.media-comment__avatar.has-active-story.is-story-seen {
    outline-color: #cbd1da;
}

.media-card__body--link {
    text-decoration: none;
    color: inherit;
    display: grid;
}

.media-card__body--link:hover .media-card__caption {
    color: var(--media-primary);
}

.media-card--wide .media-card__wide-media {
    display: block;
    text-decoration: none;
}

.media-card__action[href] {
    text-decoration: none;
}

.media-card__avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid var(--media-primary-soft);
}

.media-card__avatar--fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--media-primary-soft);
    color: var(--media-primary);
    font-weight: 700;
}

.media-card__meta {
    min-width: 0;
}

.media-card__name-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.media-card__name {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--media-text);
}

.media-card__badge {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.12rem 0.45rem;
    border-radius: 999px;
    line-height: 1.4;
}

.media-card__badge--advanced {
    background: var(--media-primary-soft);
    color: var(--media-badge-advanced);
}

.media-card__badge--beginner {
    background: #e6f6ee;
    color: var(--media-badge-beginner);
}

.media-card__badge--intermediate {
    background: #fef6e6;
    color: #b8860b;
}

.media-card__time {
    display: block;
    font-size: 0.72rem;
    color: var(--media-text-muted);
    margin-top: 0.1rem;
}

.media-card__body {
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    gap: 0.65rem;
    padding: 0 0.85rem 0.75rem;
    align-items: stretch;
    min-height: 9.5rem;
}

.media-card__text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.5rem;
    min-width: 0;
}

.media-card__caption {
    margin: 0;
    font-size: 0.8rem;
    line-height: 1.65;
    color: var(--media-text);
}

.media-caption-text {
    margin: 0;
    font-size: 0.88rem;
    line-height: 1.7;
    color: var(--media-text);
    white-space: pre-line;
    word-break: break-word;
    overflow-wrap: anywhere;
    white-space: pre-line;
    word-wrap: break-word;
    overflow-wrap: break-word;
    display: inline-block;
    line-height: 2rem;
    font-size: 14px;
    font-weight: 400;
}

.media-card__feed-caption {
    padding: 0.5rem 0.85rem 0.35rem;
}

.media-card__feed-caption .media-caption-text {
    font-size: 0.82rem;
    max-height: none;
}

.media-card__feed-caption-more {
    display: inline-block;
    margin-top: 0.35rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--media-text-muted);
    text-decoration: none;
}

.media-card__feed-caption-more:hover {
    color: var(--media-primary);
}

.media-card__hashtag {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--media-primary);
    text-decoration: none;
}

.media-card__media {
    border-radius: var(--media-radius-sm);
    overflow: hidden;
    background: #f3f4f6;
    min-height: 8.5rem;
}

.media-card__media a {
    display: block;
    height: 100%;
}

.media-card__media img {
    width: 100%;
    height: 100%;
    min-height: 8.5rem;
    max-height: 11rem;
    object-fit: cover;
    display: block;
}

.media-card--wide .media-card__wide-media {
    margin: 0 0.85rem 0.75rem;
    width: auto;
    border-radius: var(--media-radius-sm);
    overflow: hidden;
    background: #f3f4f6;
}

.media-card--wide .media-card__wide-media img {
    width: 100%;
    max-height: 14rem;
    object-fit: cover;
    display: block;
}

.media-gallery {
    position: relative;
    overflow: hidden;
    direction: ltr;
    width: 100%;
    transition: aspect-ratio 0.2s ease;
    touch-action: pan-y;
    cursor: grab;
}

.media-gallery.is-pointer-down,
.media-gallery.is-dragging {
    cursor: grabbing;
}

.media-gallery.is-dragging {
    user-select: none;
    -webkit-user-select: none;
}

.media-gallery-wrap {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
}

.media-gallery__caption {
    display: block;
    margin: 0.45rem 0.85rem 0.2rem;
    color: #4b8fbd;
    font-size: 0.8rem;
    line-height: 1.75;
    white-space: pre-line;
    overflow-wrap: anywhere;
    text-decoration: none;
}

.media-gallery__caption:hover {
    color: #256b9b;
}

.media-card__body .media-gallery__caption {
    margin: 0.4rem 0 0;
}

.media-post-detail__card > .media-gallery-wrap .media-gallery__caption {
    margin-top: 0.65rem;
}

.media-gallery__viewport {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.media-gallery__track {
    display: flex;
    width: 100%;
    height: 100%;
    transition: transform 0.28s ease;
    will-change: transform;
}

.media-gallery__slide {
    position: relative;
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
    display: block;
    background: #f3f4f6;
    cursor: default;
    user-select: none;
    -webkit-user-select: none;
}

.media-gallery__slide img {
    width: 100%;
    height: 100%;
    min-height: 0;
    max-height: none;
    object-fit: contain;
    display: block;
    pointer-events: none;
    -webkit-user-drag: none;
}

.media-gallery__like-burst {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 5;
    color: #fff;
    font-size: 4.5rem;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.3);
    pointer-events: none;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.35));
}

.media-gallery__like-burst.is-active {
    animation: media-gallery-like-burst 0.75s ease forwards;
}

@keyframes media-gallery-like-burst {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.3);
    }
    25% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.15);
    }
    55% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1);
    }
}

.media-gallery__stack-badge,
.media-gallery__counter {
    position: absolute;
    top: 0.55rem;
    z-index: 3;
    color: #fff;
    background: rgba(0, 0, 0, 0.62);
    border-radius: 999px;
    line-height: 1;
}

.media-gallery__stack-badge {
    right: 0.55rem;
    width: 1.75rem;
    height: 1.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
}

.media-gallery__counter {
    left: 0.55rem;
    padding: 0.38rem 0.55rem;
    font-size: 0.7rem;
    direction: rtl;
}

.media-gallery__dots {
    position: absolute;
    right: 50%;
    bottom: 0.55rem;
    z-index: 3;
    transform: translateX(50%);
    display: flex;
    gap: 0.25rem;
    max-width: 70%;
    padding: 0.32rem 0.45rem;
    border-radius: 999px;
    background: rgba(17, 24, 39, 0.68);
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

.media-gallery__dot {
    width: 0.4rem;
    height: 0.4rem;
    flex: 0 0 auto;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.72);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2);
}

.media-gallery__dot.is-active {
    background: #0095f6;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.9);
}

.media-card__actions {
    display: flex;
    align-items: center;
    gap: 1.1rem;
    padding: 0.35rem 0.85rem 0.5rem;
}

.media-card__action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    border: none;
    background: none;
    font-family: inherit;
    font-size: 0.82rem;
    color: #4b5563;
    cursor: pointer;
    min-width: 48px;
    min-height: 48px;
    padding: 0.5rem 0.65rem;
    margin: -0.35rem -0.4rem;
}

.media-card__action i {
    font-size: 1.15rem;
}

.media-card__action--bookmark {
    margin-right: auto;
}

.media-card__action--like.is-liked {
    color: #e0245e;
}

.media-card__action--like.is-liked i {
    color: #e0245e;
}

.media-card__action--like.is-animating i {
    animation: media-like-pop 0.35s ease;
}

.media-card__action--like[aria-busy="true"] {
    opacity: 0.7;
    pointer-events: none;
}

.media-card__like-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
}

.media-card__like-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    background: transparent;
    cursor: pointer;
    font: inherit;
    font-weight: 600;
    font-size: 0.82rem;
    color: inherit;
    min-width: 48px;
    min-height: 48px;
    padding: 0.35rem 0.45rem;
}

.media-card__like-count:hover,
.media-card__like-count:focus-visible {
    text-decoration: underline;
    outline: none;
}

@keyframes media-like-pop {
    0% {
        transform: scale(1);
    }
    40% {
        transform: scale(1.28);
    }
    100% {
        transform: scale(1);
    }
}

.media-card__likes-line {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0;
    padding: 0 0.85rem 0.55rem;
    font-size: 0.75rem;
    color: var(--media-text-muted);
    line-height: 1.5;
    min-width: 0;
}

.media-card__likes-line [data-likes-text-for] {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.media-card__liker-name {
    font-weight: 700;
    color: var(--media-text);
    text-decoration: none;
}

a.media-card__liker-name:hover {
    color: var(--media-primary);
}

.media-card__like-avatars {
    display: inline-flex;
    flex-direction: row-reverse;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    min-width: 48px;
    min-height: 48px;
    padding: 0.55rem 0.35rem;
    margin: -0.55rem 0;
    border: 0;
    background: transparent;
    font: inherit;
    color: inherit;
    cursor: pointer;
    border-radius: 999px;
}

.media-card__like-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.4rem;
    height: 1.4rem;
    position: relative;
    border-radius: 50%;
    border: 2px solid #fff;
    margin-right: -0.45rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
    overflow: hidden;
    pointer-events: none;
}

.media-card__like-avatar > img,
.media-card__like-avatar > span {
    width: 100%;
    height: 100%;
    margin: 0;
    border: 0;
    object-fit: cover;
    display: flex;
    align-items: center;
    justify-content: center;
}

.media-card__like-avatar:first-child {
    margin-right: 0;
}

.media-card__like-avatars img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 0;
    margin: 0;
    object-fit: cover;
}

.media-card__comments {
    margin: 0 0.85rem 0.85rem;
    padding: 0.65rem 0.75rem;
    background: var(--media-primary-soft);
    border-radius: var(--media-radius-sm);
}

.media-card__comment {
    margin: 0 0 0.4rem;
    font-size: 0.78rem;
    line-height: 1.55;
    color: var(--media-text);
}

.media-card__comment:last-of-type {
    margin-bottom: 0.35rem;
}

.media-card__comment strong {
    font-weight: 700;
}

.media-card__comments-more {
    display: inline-block;
    font-size: 0.75rem;
    color: var(--media-text-muted);
    text-decoration: none;
}

.media-card__comments-more:hover {
    color: var(--media-primary);
}

/* ── Top nav ── */
.media-top-nav {
    position: sticky;
    top: 0;
    z-index: 120;
    background: var(--media-bg);
    border-bottom: 1px solid var(--media-border);
    box-shadow: 0 2px 12px rgba(26, 45, 95, 0.05);
    padding-top: env(safe-area-inset-top, 0);
}

.media-top-nav__inner {
    display: flex;
    align-items: stretch;
    justify-content: space-around;
    max-width: 100%;
    height: var(--media-top-nav-h);
    margin: 0 auto;
    padding: 0 0.35rem;
}

.media-top-nav__item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.12rem;
    min-width: 0;
    text-decoration: none;
    color: var(--media-text-muted);
    font-size: 0.62rem;
    font-weight: 500;
    padding: 0.2rem 0.1rem;
    border-radius: 10px;
    transition: color 0.15s ease, background 0.15s ease;
    white-space: nowrap;
}

.media-top-nav__item i {
    font-size: 1.15rem;
    line-height: 1;
}

.media-top-nav__logo {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    padding: 0.25rem;
}

.media-top-nav__logo img {
    display: block;
    width: auto;
    height: 2.5rem;
    max-width: 100%;
    object-fit: contain;
}

.media-top-nav__icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.media-top-nav__item:hover {
    color: var(--media-text);
    background: #f8f9fb;
}

.media-top-nav__item.is-active {
    color: var(--media-primary);
    font-weight: 700;
}

.media-top-nav__item.is-active i {
    color: var(--media-primary);
}

.media-notification-badge {
    position: absolute;
    top: -0.42rem;
    left: -0.55rem;
    min-width: 1.05rem;
    height: 1.05rem;
    padding: 0 0.22rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--media-bg);
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 0.58rem;
    font-weight: 800;
    line-height: 1;
}

/* Hide top nav on create flows */
.media-body--create .media-top-nav,
.media-body--no-top-nav .media-top-nav {
    display: none;
}

.media-body--create .media-header,
.media-body--no-top-nav .media-header {
    top: var(--media-return-context-h);
}

/* ── Desktop ── */
@media (min-width: 768px) {
    .media-app {
        max-width: 720px;
        padding-bottom: 2rem;
        box-shadow: 0 0 0 1px var(--media-border);
    }

    .media-top-nav__inner {
        padding: 0 0.75rem;
    }

    .media-top-nav__item {
        font-size: 0.68rem;
        gap: 0.15rem;
    }

    .media-top-nav__item i {
        font-size: 1.25rem;
    }

    .media-header {
        border-radius: 0;
    }

    .media-header__logo img {
        height: 2.6rem;
    }

    .media-stories__track {
        justify-content: flex-start;
        flex-wrap: nowrap;
        overflow-x: auto;
    }

    .media-tabs__item {
        font-size: 0.85rem;
    }

    .media-card__body {
        min-height: 11rem;
    }

    .media-card__media img {
        max-height: 13rem;
    }
}

@media (min-width: 992px) {
    .media-app {
        position: relative;
        max-width: var(--media-feed-desktop);
        margin: 0 auto;
        padding: 0 0 2rem;
        box-shadow: none;
        border-left: 1px solid var(--media-border);
        border-right: 1px solid var(--media-border);
    }

    .media-top-nav__inner {
        max-width: var(--media-feed-desktop);
    }

    .media-header {
        position: sticky;
        padding: 1rem 1rem 0.75rem;
        border-bottom: 1px solid var(--media-border);
    }

    .media-header__row {
        margin-bottom: 0.75rem;
    }

    .media-stories {
        padding: 0.85rem 0 0.35rem;
    }

    .media-stories__track {
        padding: 0 1rem 0.25rem;
        justify-content: flex-start;
        overflow-x: auto;
    }

    .media-tabs {
        max-width: none;
        margin: 0 0 0.85rem;
        padding: 0 0.5rem;
    }

    .media-tabs__item {
        font-size: 0.85rem;
        padding: 0.7rem 0.25rem;
    }

    /* Instagram-style: single column feed */
    .media-feed {
        display: flex;
        flex-direction: column;
        gap: 0;
        padding: 0 0 2rem;
        max-width: 100%;
        margin: 0;
    }

    .media-card {
        border-radius: 0;
        box-shadow: none;
        border: none;
        border-bottom: 1px solid var(--media-border);
    }

    .media-card__body {
        grid-template-columns: 1fr;
        min-height: auto;
        padding: 0;
        gap: 0;
    }

    .media-card__media {
        border-radius: 0;
    }

    .media-card__media img {
        max-height: none;
        min-height: auto;
        aspect-ratio: 1 / 1;
    }

    .media-card__text {
        padding: 0.65rem 0.85rem 0.25rem;
    }

    .media-card--wide .media-card__wide-media {
        margin: 0;
        border-radius: 0;
    }

    .media-card--wide .media-card__wide-media img {
        max-height: none;
    }

    .media-gallery__slide img {
        aspect-ratio: auto;
        object-fit: contain;
    }
}

/* ── Instagram-style inline content controls ── */
body.media-overlay-open {
    overflow: hidden;
}

.media-sheet-backdrop[hidden],
.media-action-sheet[hidden],
.media-delete-dialog[hidden],
.media-toast[hidden] {
    display: none !important;
}

.media-sheet-backdrop {
    position: fixed;
    inset: 0;
    z-index: 100100;
    background: rgba(0, 0, 0, 0.48);
    backdrop-filter: blur(1px);
}

.media-action-sheet {
    position: fixed;
    right: 0.75rem;
    bottom: max(0.75rem, env(safe-area-inset-bottom));
    left: 0.75rem;
    z-index: 100101;
    overflow: hidden;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 18px 55px rgba(0, 0, 0, 0.2);
    transform: translateY(calc(100% + 2rem));
    transition: transform 180ms ease;
}

.media-action-sheet.is-open {
    transform: translateY(0);
}

.media-action-sheet__item {
    display: block;
    width: 100%;
    min-height: 56px;
    border: 0;
    border-bottom: 1px solid #edf0f4;
    background: #fff;
    color: #1f2937;
    font: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
}

.media-action-sheet__item:last-child {
    border-bottom: 0;
}

.media-action-sheet__item--danger {
    color: #dc2626;
}

.media-delete-dialog {
    position: fixed;
    inset: 0;
    z-index: 100200;
    display: grid;
    place-items: center;
    padding: 1.25rem;
    background: rgba(0, 0, 0, 0.52);
}

.media-delete-dialog__panel {
    width: min(100%, 360px);
    overflow: hidden;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
    text-align: center;
}

.media-delete-dialog__content {
    padding: 1.5rem 1.25rem 1.15rem;
}

.media-delete-dialog h2 {
    margin: 0 0 0.6rem;
    font-size: 1.05rem;
}

.media-delete-dialog p {
    margin: 0;
    color: #6b7280;
    font-size: 0.82rem;
    line-height: 1.8;
}

.media-delete-dialog__reason {
    display: block;
    margin-top: 1rem;
    text-align: right;
}

.media-delete-dialog__reason[hidden] {
    display: none !important;
}

.media-delete-dialog__reason span,
.media-delete-dialog__reason small {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.76rem;
}

.media-delete-dialog__reason textarea {
    width: 100%;
    resize: vertical;
    border: 1px solid #dbe0e7;
    border-radius: 10px;
    padding: 0.7rem;
    font: inherit;
    font-size: 0.82rem;
    outline: none;
}

.media-delete-dialog__reason textarea:focus {
    border-color: var(--media-primary);
}

.media-delete-dialog__reason small {
    min-height: 1.2em;
    margin-top: 0.35rem;
    color: #dc2626;
}

.media-delete-dialog__action {
    display: block;
    width: 100%;
    min-height: 52px;
    border: 0;
    border-top: 1px solid #edf0f4;
    background: #fff;
    color: #374151;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.media-delete-dialog__action--danger {
    color: #dc2626;
}

.media-delete-dialog__action:disabled {
    opacity: 0.55;
}

.media-toast {
    position: fixed;
    right: 50%;
    bottom: 1rem;
    z-index: 100300;
    max-width: calc(100% - 2rem);
    padding: 0.7rem 1rem;
    border-radius: 999px;
    background: #111827;
    color: #fff;
    font-size: 0.8rem;
    transform: translate(50%, 1rem);
    opacity: 0;
    transition: 160ms ease;
}

.media-toast.is-visible {
    transform: translate(50%, 0);
    opacity: 1;
}

.media-profile-menu {
    position: relative;
}

.media-profile-menu summary {
    list-style: none;
}

.media-profile-menu summary::-webkit-details-marker {
    display: none;
}

.media-profile-menu__panel {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    z-index: 120;
    width: 210px;
    overflow: hidden;
    border: 1px solid var(--media-border);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 16px 45px rgba(15, 23, 42, 0.14);
}

.media-profile-menu__panel a,
.media-profile-menu__panel button {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    min-height: 50px;
    padding: 0 1rem;
    border: 0;
    border-bottom: 1px solid var(--media-border);
    background: #fff;
    color: var(--media-text);
    font: inherit;
    font-size: 0.82rem;
    text-decoration: none;
    cursor: pointer;
}

.media-profile-menu__panel > :last-child {
    border-bottom: 0;
}

.media-profile-menu__panel i {
    width: 1.25rem;
    font-size: 1rem;
    text-align: center;
}

.media-header__spacer {
    width: 2.5rem;
}

.media-story-archive {
    width: min(100%, var(--media-feed-desktop));
    margin: 0 auto;
    padding: 0.75rem 0.75rem 1rem;
}

.media-story-archive__intro {
    margin: 0 0 0.85rem;
    color: var(--media-text-muted);
    font-size: 0.78rem;
}

.media-story-archive__grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 3px;
}

.media-story-archive__card {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 0;
}

.media-story-archive__item {
    position: relative;
    display: block;
    padding: 0;
    overflow: hidden;
    border: 0;
    aspect-ratio: 9 / 16;
    background: #111827;
    cursor: pointer;
}

.media-story-archive__item img,
.media-story-archive__item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-story-archive__meta {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
    padding: 1.2rem 0.45rem 0.4rem;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.72));
    color: #fff;
    font-size: 0.64rem;
}

.media-story-archive__republish-form {
    margin: 0;
}

.media-story-archive__republish-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    width: 100%;
    min-height: 2.25rem;
    padding: 0.35rem 0.5rem;
    border: 1px solid var(--media-border);
    border-radius: 0.45rem;
    background: var(--media-surface);
    color: var(--media-text);
    font-size: 0.68rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.media-story-archive__republish-btn:hover {
    background: var(--media-surface-hover, #f3f4f6);
    border-color: var(--media-accent, #6366f1);
    color: var(--media-accent, #6366f1);
}

.media-story-archive__republish-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.media-story-archive__video-icon {
    position: absolute;
    top: 0.45rem;
    left: 0.45rem;
    color: #fff;
    text-shadow: 0 1px 4px #000;
}

@media (min-width: 700px) {
    .media-action-sheet {
        right: 50%;
        left: auto;
        width: 390px;
        transform: translate(50%, calc(100% + 2rem));
    }

    .media-action-sheet.is-open {
        transform: translate(50%, 0);
    }
}

/* ── Post detail page ── */
.media-header--detail,
.media-header--post {
    border-bottom: 1px solid var(--media-border);
}

.media-header--post .media-header__row {
    margin-bottom: 0;
}

.media-header__post-user {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-width: 0;
    text-decoration: none;
    color: var(--media-text);
}

.media-header__post-user img,
.media-header__post-user > span:first-child {
    width: 1.85rem;
    height: 1.85rem;
    border-radius: 50%;
    object-fit: cover;
    background: #e8effc;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 700;
    flex-shrink: 0;
}

.media-header__post-user strong {
    font-size: 0.88rem;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.media-body--post-detail .media-post-detail {
    padding: 0 0 calc(4.75rem + env(safe-area-inset-bottom));
    max-width: var(--media-feed-desktop);
    margin: 0 auto;
}

.media-post-detail--ig .media-post-detail__card {
    border: 0;
    border-radius: 0;
    box-shadow: none;
    margin-bottom: 0;
    background: var(--media-bg);
}

.media-post-detail__body {
    padding: 0.35rem 0.85rem 0.5rem;
}

.media-post-detail__actions {
    padding: 0.35rem 0 0.15rem;
    gap: 1rem;
}

.media-post-detail__actions .media-card__action--bookmark,
.media-post-detail__actions .media-save-btn {
    margin-right: auto;
}

.media-post-detail__caption {
    font-size: 0.86rem;
    line-height: 1.55;
    color: var(--media-text);
    margin: 0.15rem 0 0.35rem;
}

.media-post-detail__caption-user {
    font-weight: 700;
    color: var(--media-primary);
    text-decoration: none;
    margin-left: 0.35rem;
}

.media-post-detail__caption-user:hover {
    text-decoration: underline;
}

.media-rich-link {
    color: var(--media-primary);
    font-weight: 500;
    text-decoration: none;
    word-break: break-word;
}

.media-rich-link:hover {
    text-decoration: underline;
}

.media-post-detail__caption .media-caption-text {
    display: inline;
    font-size: inherit;
    line-height: inherit;
    margin: 0;
}

.media-post-detail__time {
    display: block;
    margin: 0 0 0.65rem;
    font-size: 0.68rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--media-text-muted);
}

.media-post-detail__breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.78rem;
    color: var(--media-muted, #6b7280);
    margin: 0.75rem 0 1rem;
}

.media-post-detail__breadcrumb a {
    color: inherit;
    text-decoration: none;
}

.media-post-detail__breadcrumb a:hover {
    color: var(--media-accent, #2563eb);
    text-decoration: underline;
}

.media-post-detail__title {
    margin: 0;
    padding: 0.85rem 0.85rem 0;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.45;
    color: var(--media-text, #111827);
}

.media-feed__heading {
    margin: 0 0 0.75rem;
    padding: 0 0.15rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--media-text, #111827);
}

.media-feed__loading {
    min-height: 2.8rem;
    display: grid;
    place-items: center;
    color: var(--media-text-muted);
    font-size: 0.82rem;
    padding: 0.5rem 0 1rem;
}

.media-post-detail__card {
    background: var(--media-bg);
    border-radius: var(--media-radius);
    box-shadow: var(--media-card-shadow);
    border: 1px solid var(--media-border);
    overflow: hidden;
    margin-bottom: 1.25rem;
}

.media-post-detail__media {
    width: min(100%, var(--media-max));
    height: 605px;
    min-height: 605px;
    max-height: 605px;
    margin: 0 auto;
    border-radius: 0;
    overflow: hidden;
    background: #0b0f14;
}

.media-post-detail__media .media-gallery__viewport,
.media-post-detail__media .media-gallery__track,
.media-post-detail__media .media-gallery__slide {
    width: 100%;
    height: 100%;
    min-height: 0;
    max-height: none;
}

.media-post-detail__media img {
    width: 100%;
    height: 100%;
    min-height: 0;
    max-height: none;
    object-fit: contain;
    display: block;
    background: #0b0f14;
}

.media-post-detail__media .media-gallery__slide img {
    object-fit: contain;
    max-height: none;
    background: #0b0f14;
}

.media-post-detail__text {
    padding: 0.85rem 0.85rem 0.35rem;
}

.media-post-detail__text .media-caption-text {
    font-size: 0.92rem;
    margin-bottom: 0.5rem;
}

.media-comments--detail {
    margin: 0;
    padding: 0;
    scroll-margin-top: calc(var(--media-top-nav-h) + 3rem);
}

.media-comments--detail .media-comments__list {
    gap: 0.85rem;
    max-height: none;
    overflow: visible;
    padding: 0;
}

.media-comments--detail .media-comment {
    align-items: flex-start;
}

.media-comments--detail .media-comment__avatar {
    width: 2.75rem;
    height: 2.75rem;
    font-size: 0.78rem;
}

.media-comments--detail .media-comments__composer-wrap {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 105;
    max-width: var(--media-feed-desktop);
    margin: 0 auto;
    background: var(--media-bg);
    border-top: 1px solid var(--media-border);
    padding: 0.55rem 0.75rem calc(0.55rem + env(safe-area-inset-bottom));
    box-shadow: 0 -6px 18px rgba(26, 45, 95, 0.06);
}

.media-comments--detail .media-comments__composer {
    gap: 0.45rem;
    padding: 0.35rem 0.45rem 0.35rem 0.55rem;
    border: 1px solid #dbe0ea;
    border-radius: 999px;
    background: #f8f9fb;
}

.media-comments__composer-avatar {
    flex: 0 0 auto;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    overflow: hidden;
    background: #e8effc;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--media-primary);
}

.media-comments__composer-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-comments--detail .media-comments__input {
    background: transparent;
    border-radius: 0;
    padding: 0.45rem 0.25rem;
    font-size: 0.84rem;
}

.media-comments--detail .media-comments__input:focus {
    box-shadow: none;
}

.media-comments--detail .media-comments__composer:focus-within {
    border-color: #b7c4de;
    background: #fff;
}

.media-comments--detail .media-comments__voice-btn {
    width: 2rem;
    height: 2rem;
    background: transparent;
    color: var(--media-primary);
    flex-shrink: 0;
}

.media-comments--detail .media-comments__submit {
    font-size: 0.86rem;
    padding-left: 0.35rem;
}

.media-comments--detail .media-comments__login-prompt {
    display: block;
    padding: 0.35rem 0;
    font-size: 0.82rem;
    color: var(--media-text-muted);
    text-decoration: none;
}

.media-comments--detail .media-comments__more-wrap {
    margin: 0.25rem 0 0.5rem;
}

.media-comments--detail .media-comments__more-btn {
    padding: 0;
    font-size: 0.8rem;
    color: var(--media-text-muted);
}

.media-comments {
    margin: 0 0 4.5rem;
    padding: 0 0.85rem 0.5rem;
    scroll-margin-top: calc(var(--media-top-nav-h) + 3rem);
}

/* ── Comments (shared) ── */
.media-comments__head {
    margin-bottom: 0.5rem;
}

.media-comments__title {
    margin: 0;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--media-text);
}

.media-comments__list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    max-height: none;
    overflow-y: visible;
    padding: 0.25rem 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.media-comments:not(.media-comments--sheet) .media-comments__list {
    max-height: none;
}

.media-comments__empty {
    margin: 0;
    font-size: 0.82rem;
    color: var(--media-text-muted);
    text-align: center;
    padding: 1rem 0;
}

.media-comment {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    border-radius: 0.75rem;
    padding: 0.15rem;
    margin: -0.15rem;
    transition: background-color 0.16s ease, box-shadow 0.16s ease;
}

.media-comment.is-delete-target,
.media-comment:has(.media-comment__delete:hover),
.media-comment:has(.media-comment__delete:focus-visible) {
    background: rgba(220, 53, 69, 0.07);
    box-shadow: 0 0 0 1px rgba(220, 53, 69, 0.11);
}

.media-comment__delete {
    flex: 0 0 auto;
    width: 1.8rem;
    height: 1.8rem;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #dc3545;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
}

.media-comment__delete:hover,
.media-comment__delete:focus {
    background: rgba(220, 53, 69, 0.08);
    color: #dc3545;
}

.media-comment__delete i {
    font-size: 0.95rem;
    line-height: 1;
}

.media-comment__avatar {
    position: relative;
    flex: 0 0 2.75rem;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    background: var(--media-primary-soft);
    color: var(--media-primary);
    font-size: 0.78rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    overflow: hidden;
}

.media-comment__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-comment__body {
    flex: 1;
    min-width: 0;
}

.media-comment__text,
.media-comment__meta-line {
    margin: 0;
    font-size: 0.82rem;
    line-height: 1.55;
    color: var(--media-text);
    word-break: break-word;
}

.media-comment__author {
    font-weight: 700;
    margin-left: 0.35rem;
    color: inherit;
    text-decoration: none;
}

a.media-comment__author {
    color: var(--media-primary);
}

a.media-comment__author:hover {
    text-decoration: underline;
}

.media-comment__voice {
    width: min(100%, 17rem);
    min-height: 2.75rem;
    margin-top: 0.3rem;
    padding: 0.45rem 0.55rem;
    border-radius: 0.9rem;
    background: linear-gradient(135deg, rgba(45, 91, 209, 0.12), rgba(37, 188, 146, 0.12));
    border: 1px solid rgba(45, 91, 209, 0.12);
    display: grid;
    grid-template-columns: 2rem minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.5rem;
}

.media-comment__voice-play,
.media-comments__voice-play,
.media-comments__voice-btn {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--media-primary);
    color: #fff;
    cursor: pointer;
    flex: 0 0 auto;
}

.media-comment__voice-play i,
.media-comments__voice-play i,
.media-comments__voice-btn i {
    font-size: 0.8rem;
}

.media-comment__voice-waveform,
.media-comments__waveform {
    height: 2rem;
    display: flex;
    align-items: center;
    gap: 2px;
    overflow: hidden;
}

.media-comment__voice-waveform span,
.media-comments__waveform span {
    width: 3px;
    min-height: 0.35rem;
    border-radius: 999px;
    background: rgba(45, 91, 209, 0.32);
    transform-origin: center;
    transition: background-color 0.18s ease, transform 0.18s ease;
}

.media-comment__voice-waveform span.is-played,
.media-comments__waveform span.is-played {
    background: var(--media-primary);
}

.media-comment__voice-duration {
    font-size: 0.68rem;
    color: var(--media-text-muted);
    direction: ltr;
}

.media-comment__time {
    display: block;
    margin-top: 0.2rem;
    font-size: 0.68rem;
    color: var(--media-text-muted);
}

.media-comments__more-wrap {
    padding: 0.35rem 0 0.65rem;
    text-align: center;
}

.media-comments__more-btn {
    border: none;
    background: none;
    color: var(--media-text-muted);
    font-size: 0.76rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
}

.media-comments__more-btn:hover:not(:disabled) {
    color: var(--media-primary);
}

.media-comments__more-btn:disabled {
    opacity: 0.6;
    cursor: wait;
}

.media-comments__composer-wrap {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 105;
    background: var(--media-bg);
    border-top: 1px solid var(--media-border);
    padding: 0.55rem 0.85rem calc(0.55rem + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 16px rgba(26, 45, 95, 0.06);
}

.media-comments__composer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.media-comments__input {
    flex: 1;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    border: none;
    background: var(--media-primary-soft);
    border-radius: 999px;
    padding: 0.65rem 1rem;
    font-size: 1rem;
    color: var(--media-text);
    outline: none;
}

.media-comments__input::placeholder {
    color: var(--media-text-muted);
}

.media-comments__input:focus {
    box-shadow: 0 0 0 2px rgba(45, 91, 209, 0.2);
}

.media-comments__submit {
    flex: 0 0 auto;
    border: none;
    background: none;
    color: var(--media-primary);
    font-size: 0.84rem;
    font-weight: 700;
    padding: 0.35rem 0.15rem;
    cursor: pointer;
}

.media-comments__submit:disabled {
    opacity: 0.35;
    cursor: default;
}

.media-comments__voice-btn {
    background: var(--media-primary-soft);
    color: var(--media-primary);
}

.media-comments__voice-panel {
    margin-top: 0.5rem;
    padding: 0.55rem;
    border: 1px solid var(--media-border);
    border-radius: 0.9rem;
    background: #fff;
}

.media-comments__voice-status,
.media-comments__voice-actions,
.media-comments__voice-preview {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.media-comments__voice-status {
    justify-content: space-between;
    font-size: 0.78rem;
    color: var(--media-text);
}

.media-comments__voice-status strong {
    direction: ltr;
    color: var(--media-primary);
}

.media-comments__voice-preview {
    margin-top: 0.45rem;
}

.media-comments__voice-preview .media-comments__waveform {
    flex: 1;
    min-width: 0;
}

.media-comments__voice-actions {
    justify-content: flex-end;
    margin-top: 0.5rem;
}

.media-comments__voice-action {
    border: 1px solid var(--media-border);
    background: #fff;
    color: var(--media-text);
    border-radius: 999px;
    padding: 0.35rem 0.75rem;
    font-size: 0.76rem;
    font-weight: 700;
    cursor: pointer;
}

.media-comments__voice-action--primary {
    border-color: var(--media-primary);
    background: var(--media-primary);
    color: #fff;
}

.media-comments__voice-action:disabled {
    opacity: 0.45;
    cursor: default;
}

.media-comments__error {
    margin: 0.35rem 0 0;
    font-size: 0.75rem;
    color: #dc3545;
}

.media-comments__login-prompt {
    display: block;
    text-align: center;
    padding: 0.65rem 1rem;
    background: var(--media-primary-soft);
    border-radius: 999px;
    color: var(--media-primary);
    font-size: 0.84rem;
    font-weight: 600;
    text-decoration: none;
}

.media-comment-delete-modal[hidden] {
    display: none;
}

.media-comment-delete-modal {
    position: fixed;
    inset: 0;
    z-index: 260;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.media-comment-delete-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.36);
}

.media-comment-delete-modal__dialog {
    position: relative;
    width: min(100%, 22rem);
    max-height: min(70vh, 24rem);
    overflow-y: auto;
    border-radius: 1rem;
    background: #fff;
    padding: 1rem;
    box-shadow: 0 1.2rem 3rem rgba(15, 23, 42, 0.22);
}

.media-comment-delete-modal__title {
    margin: 0 0 0.35rem;
    font-size: 1rem;
    font-weight: 800;
    color: var(--media-text);
}

.media-comment-delete-modal__text {
    margin: 0;
    font-size: 0.84rem;
    line-height: 1.7;
    color: var(--media-text-muted);
}

.media-comment-delete-modal__actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.55rem;
    margin-top: 1rem;
}

.media-comment-delete-modal__cancel,
.media-comment-delete-modal__confirm {
    border: none;
    border-radius: 999px;
    padding: 0.65rem 0.85rem;
    font-size: 0.84rem;
    font-weight: 800;
    cursor: pointer;
}

.media-comment-delete-modal__cancel {
    background: var(--media-primary-soft);
    color: var(--media-text);
}

.media-comment-delete-modal__confirm {
    background: #dc3545;
    color: #fff;
}

.media-comment-delete-modal__confirm:disabled {
    opacity: 0.55;
    cursor: wait;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.media-post-detail__cta-wrap {
    padding: 0 0.85rem 1rem;
}

.media-post-detail__cta {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.1rem;
    background: var(--media-primary);
    color: #fff;
    border-radius: 999px;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
}

.media-post-detail__cta:hover {
    color: #fff;
    opacity: 0.92;
}

.media-post-detail__related {
    margin-top: 1.25rem;
    padding-bottom: 0.5rem;
}

.media-post-detail__related-title {
    margin: 0 0 0.75rem;
    padding: 0 1rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--media-text);
}

.media-related-strip {
    --media-related-gap: 0.625rem;
    --media-related-visible: 2.3;
    --media-related-gap-count: 2;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: var(--media-related-gap);
    margin: 0;
    padding: 0 1rem 0.35rem;
    list-style: none;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 1rem;
    scrollbar-width: none;
}

.media-related-strip::-webkit-scrollbar {
    display: none;
}

.media-related-strip__li {
    flex: 0 0 calc((100% - var(--media-related-gap-count) * var(--media-related-gap)) / var(--media-related-visible));
    min-width: 0;
    list-style: none;
    scroll-snap-align: start;
}

.media-related-strip__item {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 5;
    border-radius: var(--media-radius-sm);
    overflow: hidden;
    background: #f3f4f6;
    text-decoration: none;
    border: 1px solid var(--media-border);
    box-shadow: 0 2px 10px rgba(26, 45, 95, 0.08);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    padding: 0;
    font: inherit;
    cursor: pointer;
}

.media-related-strip__item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.media-related-strip__item:hover,
.media-related-strip__item:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(26, 45, 95, 0.14);
}

.media-related-strip--skeleton .media-related-strip__item {
    background: linear-gradient(90deg, #f0f2f6 25%, #e4e8ef 50%, #f0f2f6 75%);
    background-size: 200% 100%;
    animation: media-related-shimmer 1.15s ease-in-out infinite;
    border-color: transparent;
    box-shadow: none;
}

@keyframes media-related-shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

@media (min-width: 768px) {
    .media-related-strip {
        --media-related-visible: 3.5;
        --media-related-gap-count: 3;
    }
}

@media (min-width: 992px) {
    .media-related-strip {
        --media-related-visible: 4.5;
        --media-related-gap-count: 4;
    }
}

@media (min-width: 992px) {
    .media-post-detail--ig {
        padding-bottom: calc(4.75rem + env(safe-area-inset-bottom));
    }

    .media-post-detail__media img {
        max-height: 75vh;
    }

    .media-comments--detail .media-comments__composer-wrap {
        width: var(--media-feed-desktop);
    }

    .media-comments:not(.media-comments--detail):not(.media-comments--sheet) .media-comments__list {
        max-height: min(50vh, 420px);
    }
}

/* ── Forms & publish ── */
.media-form__heading {
    flex: 1;
    text-align: center;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--media-text);
}

.media-form-page {
    padding: 1rem 1rem 2rem;
    max-width: 520px;
    margin: 0 auto;
}

.media-form__intro {
    text-align: center;
    color: var(--media-text-muted);
    font-size: 0.88rem;
    margin: 0 0 1.25rem;
}

.media-publish-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem;
}

.media-publish-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1.25rem 0.75rem;
    border-radius: var(--media-radius);
    border: 1px solid var(--media-border);
    background: #fff;
    box-shadow: var(--media-card-shadow);
    text-decoration: none;
    color: var(--media-text);
    gap: 0.35rem;
}

.media-publish-card__icon {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: var(--media-primary-soft);
    color: var(--media-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    margin-bottom: 0.25rem;
}

.media-publish-card__title {
    font-weight: 700;
    font-size: 0.95rem;
}

.media-publish-card__desc {
    font-size: 0.72rem;
    color: var(--media-text-muted);
    line-height: 1.45;
}

.media-publish-card__denial {
    font-size: 0.68rem;
    color: #dc3545;
    margin-top: 0.25rem;
}

.media-publish-card.is-disabled {
    opacity: 0.55;
    pointer-events: none;
}

.media-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.media-form__group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.media-form__label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--media-text);
}

.media-form__input,
.media-form__textarea,
.media-form__file {
    width: 100%;
    font-family: inherit;
    font-size: 0.88rem;
    border: 1px solid var(--media-border);
    border-radius: var(--media-radius-sm);
    padding: 0.65rem 0.85rem;
    background: #f9fafb;
    color: var(--media-text);
}

.media-form__input:focus,
.media-form__textarea:focus {
    outline: none;
    border-color: var(--media-primary);
    background: #fff;
}

.media-form__textarea {
    resize: vertical;
    min-height: 5rem;
}

.media-form__radios {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.media-form__radio {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    cursor: pointer;
}

.media-form__submit {
    margin-top: 0.5rem;
    width: 100%;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 999px;
    background: var(--media-primary);
    color: #fff;
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
}

.media-form__submit:hover {
    opacity: 0.92;
}

.media-alert {
    padding: 0.65rem 0.85rem;
    border-radius: var(--media-radius-sm);
    font-size: 0.82rem;
    margin-bottom: 1rem;
}

.media-alert--success {
    background: #e6f6ee;
    color: #157347;
}

.media-alert--error {
    background: #fde8e8;
    color: #b42318;
}

.media-alert__list {
    margin: 0;
    padding-right: 1.1rem;
}

.media-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--media-text-muted);
}

.media-empty__btn {
    display: inline-block;
    margin-top: 0.85rem;
    padding: 0.55rem 1.25rem;
    background: var(--media-primary);
    color: #fff;
    border-radius: 999px;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
}

.media-notifications {
    width: min(100%, 720px);
    margin: 0 auto;
    padding: 0.35rem 0 5.5rem;
}

.media-notification {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 4.75rem;
    padding: 0.72rem 1rem;
    border-bottom: 1px solid var(--media-border);
    color: var(--media-text);
    text-decoration: none;
    background: var(--media-bg);
}

.media-notification:hover {
    color: var(--media-text);
    background: #f8fafc;
}

.media-notification.is-unread {
    background: #f5f9ff;
}

.media-notification__hit {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.media-notification__avatar,
.media-notification__actor {
    position: relative;
    z-index: 1;
}

.media-notification__avatar,
.media-notification__avatar img,
.media-notification__avatar span {
    width: 2.8rem;
    height: 2.8rem;
    border-radius: 50%;
    flex: 0 0 auto;
}

.media-notification__avatar {
    display: block;
    text-decoration: none;
    color: inherit;
}

.media-notification__avatar img {
    display: block;
    object-fit: cover;
}

.media-notification__avatar span {
    display: grid;
    place-items: center;
    background: #e5edf7;
    color: #2f5f88;
    font-size: 1rem;
    font-weight: 800;
}

.media-notification__body {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
}

.media-notification__text {
    color: #1f2937;
    font-size: 0.88rem;
    font-weight: 650;
    line-height: 1.75;
    overflow-wrap: anywhere;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}

.media-notification__actor {
    color: inherit;
    font-weight: 800;
    text-decoration: none;
}

.media-notification__actor:hover {
    text-decoration: underline;
}

.media-notification__time {
    color: var(--media-text-muted);
    font-size: 0.74rem;
}

.media-notification__dot {
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    background: var(--media-primary);
    flex: 0 0 auto;
}

.media-notification-sheet-open {
    overflow: hidden;
}

.media-follow-list-sheet-open {
    overflow: hidden;
}

.media-notification-sheet {
    position: fixed;
    inset: 0;
    z-index: 1300;
}

.media-follow-list-sheet {
    position: fixed;
    inset: 0;
    z-index: 1300;
}

.media-notification-sheet[hidden] {
    display: none;
}

.media-follow-list-sheet[hidden] {
    display: none;
}

.media-notification-sheet__backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    background: rgba(15, 23, 42, 0.36);
    cursor: pointer;
}

.media-follow-list-sheet__backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    background: rgba(15, 23, 42, 0.36);
    cursor: pointer;
}

.media-notification-sheet__panel {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 90dvh;
    max-height: 90dvh;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    overflow: hidden;
    border-radius: 18px 18px 0 0;
    background: var(--media-bg);
    box-shadow: 0 -16px 40px rgba(15, 23, 42, 0.22);
}

.media-follow-list-sheet__panel {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 90dvh;
    max-height: 90dvh;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    overflow: hidden;
    border-radius: 18px 18px 0 0;
    background: var(--media-bg);
    box-shadow: 0 -16px 40px rgba(15, 23, 42, 0.22);
}

.media-notification-sheet__header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 3.6rem;
    padding: 1.05rem 3.75rem 0.7rem;
    border-bottom: 1px solid var(--media-border);
}

.media-follow-list-sheet__header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 3.6rem;
    padding: 1.05rem 3.75rem 0.7rem;
    border-bottom: 1px solid var(--media-border);
}

.media-notification-sheet__handle {
    position: absolute;
    top: 0.45rem;
    right: 50%;
    width: 2.6rem;
    height: 0.24rem;
    transform: translateX(50%);
    border-radius: 999px;
    background: #cbd5e1;
}

.media-follow-list-sheet__handle {
    position: absolute;
    top: 0.45rem;
    right: 50%;
    width: 2.6rem;
    height: 0.24rem;
    transform: translateX(50%);
    border-radius: 999px;
    background: #cbd5e1;
}

.media-notification-sheet__header h2 {
    margin: 0;
    color: #111827;
    font-size: 1rem;
    font-weight: 800;
}

.media-follow-list-sheet__header h2 {
    margin: 0;
    color: #111827;
    font-size: 1rem;
    font-weight: 800;
}

.media-notification-sheet__close {
    position: absolute;
    left: 1rem;
    top: 0.78rem;
    width: 2.2rem;
    height: 2.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: #f1f5f9;
    color: #475569;
    cursor: pointer;
}

.media-follow-list-sheet__close {
    position: absolute;
    left: 1rem;
    top: 0.78rem;
    width: 2.2rem;
    height: 2.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: #f1f5f9;
    color: #475569;
    cursor: pointer;
}

.media-notification-sheet__list {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.media-follow-list-sheet__list {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.media-notification-sheet__loading {
    min-height: 2.8rem;
    display: grid;
    place-items: center;
    border-top: 1px solid var(--media-border);
    color: var(--media-text-muted);
    font-size: 0.82rem;
}

.media-follow-list-sheet__loading {
    min-height: 2.8rem;
    display: grid;
    place-items: center;
    border-top: 1px solid var(--media-border);
    color: var(--media-text-muted);
    font-size: 0.82rem;
}

.media-follow-list-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 4.5rem;
    padding: 0.72rem 1rem;
    border-bottom: 1px solid var(--media-border);
    color: var(--media-text);
    text-decoration: none;
    background: var(--media-bg);
}

.media-follow-list-item__identity {
    min-width: 0;
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: inherit;
    text-decoration: none;
}

a.media-follow-list-item__identity:hover {
    color: var(--media-text);
}

.media-follow-list-item__avatar,
.media-follow-list-item__avatar img,
.media-follow-list-item__avatar span {
    width: 2.8rem;
    height: 2.8rem;
    border-radius: 50%;
    flex: 0 0 auto;
}

.media-follow-list-item__avatar img {
    display: block;
    object-fit: cover;
}

.media-follow-list-item__avatar span {
    display: grid;
    place-items: center;
    background: #e5edf7;
    color: #2f5f88;
    font-size: 1rem;
    font-weight: 800;
}

.media-follow-list-item__body {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
}

.media-follow-list-item__name {
    color: #1f2937;
    font-size: 0.9rem;
    font-weight: 750;
    line-height: 1.65;
    overflow-wrap: anywhere;
}

.media-follow-list-item__username {
    color: var(--media-primary);
    direction: ltr;
    text-align: right;
    font-size: 0.76rem;
}

.media-follow-list-item__follow {
    flex: 0 0 auto;
    min-width: 6.25rem;
    height: 2.25rem;
    padding: 0 0.75rem;
    border: 1px solid #dbe2ea;
    border-radius: 8px;
    background: #f8fafc;
    color: #1f2937;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 750;
    cursor: pointer;
    text-decoration: none;
}

.media-follow-list-item__follow:not(.is-following) {
    border-color: var(--media-primary);
    background: var(--media-primary);
    color: #fff;
}

.media-follow-list-item__follow [data-follow-label-following],
.media-follow-list-item__follow [data-follow-label-not-following] {
    display: none;
}

.media-follow-list-item__follow.is-following [data-follow-label-following],
.media-follow-list-item__follow:not(.is-following) [data-follow-label-not-following] {
    display: inline;
}

.media-follow-list-item__follow--link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.media-follow-list-item__menu {
    position: relative;
    flex: 0 0 auto;
}

.media-follow-list-item__menu-btn {
    width: 2.2rem;
    height: 2.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #64748b;
    cursor: pointer;
}

.media-follow-list-item__menu-btn:hover,
.media-follow-list-item__menu-btn[aria-expanded="true"] {
    background: #f1f5f9;
    color: #1f2937;
}

.media-follow-list-item__menu-panel {
    position: absolute;
    left: 0;
    top: calc(100% + 0.35rem);
    z-index: 2;
    min-width: 9.5rem;
    padding: 0.35rem;
    border: 1px solid var(--media-border);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.14);
}

.media-follow-list-item__menu-action {
    width: 100%;
    min-height: 2.35rem;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0 0.7rem;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #1f2937;
    font: inherit;
    font-size: 0.8rem;
    font-weight: 700;
    text-align: right;
    text-decoration: none;
    cursor: pointer;
}

.media-follow-list-item__menu-action:hover {
    background: #f8fafc;
    color: #111827;
}

.media-follow-list-item__menu-action [data-follow-label-following],
.media-follow-list-item__menu-action [data-follow-label-not-following] {
    display: none;
}

.media-follow-list-item__menu-action.is-following [data-follow-label-following],
.media-follow-list-item__menu-action:not(.is-following) [data-follow-label-not-following] {
    display: inline;
}

@media (min-width: 768px) {
    .media-notification-sheet__panel {
        right: 50%;
        left: auto;
        width: min(100%, 720px);
        height: 70dvh;
        max-height: 70dvh;
        transform: translateX(50%);
    }

    .media-follow-list-sheet__panel {
        right: 50%;
        left: auto;
        width: min(100%, 720px);
        height: 70dvh;
        max-height: 70dvh;
        transform: translateX(50%);
    }
}

/* Likes list sheet */
.media-likes-list-sheet-open {
    overflow: hidden;
}

.media-likes-list-sheet {
    position: fixed;
    inset: 0;
    z-index: 1300;
}

.media-likes-list-sheet[hidden] {
    display: none;
}

.media-likes-list-sheet__backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    background: rgba(15, 23, 42, 0.36);
    cursor: pointer;
}

.media-likes-list-sheet__panel {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: min(90dvh, 32rem);
    max-height: min(90dvh, 32rem);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    overflow: hidden;
    border-radius: 18px 18px 0 0;
    background: var(--media-bg);
    box-shadow: 0 -16px 40px rgba(15, 23, 42, 0.22);
}

.media-likes-list-sheet__header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 3.6rem;
    padding: 1.05rem 3.75rem 0.7rem;
    border-bottom: 1px solid var(--media-border);
}

.media-likes-list-sheet__handle {
    position: absolute;
    top: 0.45rem;
    right: 50%;
    width: 2.6rem;
    height: 0.24rem;
    transform: translateX(50%);
    border-radius: 999px;
    background: #cbd5e1;
}

.media-likes-list-sheet__header h2 {
    margin: 0;
    color: #111827;
    font-size: 1rem;
    font-weight: 800;
}

.media-likes-list-sheet__close {
    position: absolute;
    left: 1rem;
    top: 0.78rem;
    width: 2.2rem;
    height: 2.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: #f1f5f9;
    color: #475569;
    cursor: pointer;
}

.media-likes-list-sheet__list {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.media-likes-list-sheet__loading {
    min-height: 2.8rem;
    display: grid;
    place-items: center;
    border-top: 1px solid var(--media-border);
    color: var(--media-text-muted);
    font-size: 0.82rem;
}

.media-likes-list-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 1rem;
    border-bottom: 1px solid var(--media-border);
}

.media-likes-list-item:last-child {
    border-bottom: 0;
}

.media-likes-list-item__identity {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
    color: inherit;
    text-decoration: none;
}

a.media-likes-list-item__identity:hover {
    color: inherit;
}

.media-likes-list-item__avatar,
.media-likes-list-item__avatar img,
.media-likes-list-item__avatar span {
    width: 2.75rem;
    height: 2.75rem;
    flex: 0 0 auto;
    border-radius: 50%;
    overflow: hidden;
}

.media-likes-list-item__avatar img {
    display: block;
    object-fit: cover;
}

.media-likes-list-item__avatar span {
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #f97316, #ec4899);
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
}

.media-likes-list-item__body {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}

.media-likes-list-item__name {
    color: #111827;
    font-size: 0.9rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.media-likes-list-item__username {
    color: var(--media-primary);
    font-size: 0.78rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.media-likes-list-item__follow {
    flex: 0 0 auto;
    min-width: 6.25rem;
    height: 2.25rem;
    padding: 0 0.75rem;
    border: 1px solid #dbe2ea;
    border-radius: 8px;
    background: #f8fafc;
    color: #1f2937;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 750;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.media-likes-list-item__follow:not(.is-following) {
    border-color: var(--media-primary);
    background: var(--media-primary);
    color: #fff;
}

.media-likes-list-item__follow [data-follow-label-following],
.media-likes-list-item__follow [data-follow-label-not-following] {
    display: none;
}

.media-likes-list-item__follow.is-following [data-follow-label-following],
.media-likes-list-item__follow:not(.is-following) [data-follow-label-not-following] {
    display: inline;
}

.media-likes-list-item__follow--link {
    border-color: var(--media-primary);
    background: var(--media-primary);
    color: #fff;
}

.media-likes-list-item__follow[aria-busy="true"] {
    opacity: 0.7;
    pointer-events: none;
}

@media (min-width: 768px) {
    .media-likes-list-sheet__panel {
        top: 50%;
        right: 50%;
        bottom: auto;
        left: auto;
        width: min(100%, 24rem);
        height: min(70dvh, 28rem);
        max-height: min(70dvh, 28rem);
        transform: translate(50%, -50%);
        border-radius: 16px;
    }

    .media-likes-list-sheet__handle {
        display: none;
    }
}

/* Username modal */
.media-username-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.media-username-modal[hidden] {
    display: none !important;
}

.media-username-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
}

.media-username-modal.is-required .media-username-modal__backdrop {
    background: rgba(15, 23, 42, 0.72);
}

body.media-username-open .media-app {
    pointer-events: none;
    user-select: none;
    filter: blur(1px);
}

.media-username-modal__dialog {
    position: relative;
    width: min(100%, 22rem);
    background: #fff;
    border-radius: var(--media-radius);
    padding: 1.25rem;
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.18);
}

.media-username-modal__title {
    margin: 0 0 0.5rem;
    font-size: 1.05rem;
    font-weight: 700;
}

.media-username-modal__hint,
.media-username-modal__rules {
    margin: 0 0 0.85rem;
    font-size: 0.8rem;
    color: var(--media-text-muted);
    line-height: 1.6;
}

.media-username-modal__label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.82rem;
    font-weight: 600;
}

.media-username-modal__input-wrap {
    display: flex;
    align-items: center;
    border: 1px solid var(--media-border);
    border-radius: var(--media-radius-sm);
    overflow: hidden;
}

.media-username-modal__prefix {
    padding: 0.65rem 0.55rem 0.65rem 0.75rem;
    color: var(--media-text-muted);
    background: #f8fafc;
    font-size: 0.9rem;
}

.media-username-modal__input {
    flex: 1;
    border: none;
    padding: 0.65rem 0.75rem;
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    direction: ltr;
    text-align: left;
}

.media-username-modal__input-wrap:focus-within {
    border-color: var(--media-primary);
    box-shadow: 0 0 0 3px var(--media-primary-soft);
}

.media-username-modal__error {
    margin: 0.5rem 0 0;
    font-size: 0.78rem;
    color: #b42318;
}

.media-username-modal__submit,
.media-username-modal__cancel {
    width: 100%;
    margin-top: 0.75rem;
    padding: 0.7rem 1rem;
    border-radius: 999px;
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
}

.media-username-modal__submit {
    border: none;
    background: var(--media-primary);
    color: #fff;
}

.media-username-modal__submit:disabled {
    opacity: 0.65;
    cursor: wait;
}

.media-username-modal__cancel {
    border: 1px solid var(--media-border);
    background: #fff;
    color: var(--media-text);
}

/* Profile page */
.media-header--compact .media-header__row {
    min-height: 3rem;
}

.media-profile__identity {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.05rem;
    text-align: center;
}

.media-profile__username,
.media-profile__name {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.media-profile__username {
    font-size: 0.9rem;
    font-weight: 700;
    direction: ltr;
    unicode-bidi: plaintext;
    color: inherit;
    text-decoration: none;
}

.media-profile {
    padding: 0.5rem 1rem;
}

.media-profile__header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 2.75rem;
    margin-bottom: 0.25rem;
}

.media-profile__header .media-icon-btn {
    width: 2.75rem;
    height: 2.75rem;
    font-size: 0.9rem;
}

.media-profile__header-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    flex: 0 0 2.75rem;
}

.media-profile__top {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.media-profile__avatar {
    width: 4.5rem;
    height: 4.5rem;
    border-radius: 50%;
    overflow: hidden;
    background: var(--media-primary-soft);
    flex-shrink: 0;
    position: relative;
}

.media-profile__avatar--has-story {
    padding: 3px;
    background: linear-gradient(135deg, #2563eb, #dc2626);
}

.media-profile__avatar--has-story.is-seen {
    background: #cbd1da;
}

.media-profile__avatar-story {
    display: block;
    width: 100%;
    height: 100%;
    padding: 2px;
    overflow: hidden;
    border: 0;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
}

.media-profile__avatar img {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 50%;
    object-fit: cover;
}

.media-profile__avatar-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--media-primary);
}

.media-profile__avatar-edit {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 1.75rem;
    height: 1.75rem;
    border: 2px solid #fff;
    border-radius: 50%;
    background: var(--media-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    text-decoration: none;
    box-shadow: 0 2px 7px rgba(0, 0, 0, 0.2);
    z-index: 1;
}

.media-profile__stats {
    flex: 1;
    display: flex;
    justify-content: space-around;
    text-align: center;
}

.media-profile__stat strong {
    display: block;
    font-size: 1rem;
}

.media-profile__stat span {
    font-size: 0.75rem;
    color: var(--media-text-muted);
}

.media-profile__stat--button {
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    cursor: pointer;
}

.media-profile__stat--button:focus-visible {
    outline: 2px solid var(--media-primary);
    outline-offset: 0.3rem;
    border-radius: 0.5rem;
}

.media-profile__name {
    margin: 0;
    font-size: 0.76rem;
    font-weight: 600;
    line-height: 1.35;
    color: var(--media-text-muted);
}

.media-profile__name a {
    color: inherit;
    text-decoration: none;
}

.media-profile__name a:hover {
    color: var(--media-primary);
}

.media-profile__actions {
    margin-top: 0.85rem;
}

.media-follow-btn {
    width: 100%;
    padding: 0.55rem 1rem;
    border: 1px solid var(--media-primary);
    border-radius: 999px;
    background: var(--media-primary);
    color: #fff;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.media-follow-btn.is-following {
    background: #fff;
    color: var(--media-text);
    border-color: var(--media-border);
}

.media-follow-btn--link {
    display: inline-flex;
}

.media-follow-btn [data-follow-label-following],
.media-follow-btn [data-follow-label-not-following] {
    display: none;
}

.media-follow-btn.is-following [data-follow-label-following] {
    display: inline;
}

.media-follow-btn:not(.is-following) [data-follow-label-not-following] {
    display: inline;
}


/* ── Fixed Instagram-style feed card: 45 + 605 + 100 = 750px ── */
.media-card.media-card--fixed {
    display: grid;
    grid-template-rows: 45px 605px auto;
    width: min(100%, var(--media-max));
    min-height: 750px;
    height: auto;
    max-height: none;
    margin-right: auto;
    margin-left: auto;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
}

.media-card--fixed .media-card__head {
    height: 45px;
    min-height: 45px;
    padding: 4px 12px;
    gap: 8px;
    border: 0;
}

.media-card--fixed .media-card__user {
    height: 100%;
    gap: 8px;
}

.media-card--fixed .media-card__avatar {
    width: 36px;
    height: 36px;
    border: 2px solid var(--media-primary-soft);
}

.media-card--fixed .media-card__meta {
    display: flex;
    align-items: center;
}

.media-card--fixed .media-card__name-row {
    gap: 6px;
    flex-wrap: nowrap;
}

.media-card--fixed .media-card__name {
    max-width: 170px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
}

.media-card--fixed .media-card__time {
    display: inline;
    margin: 0;
    white-space: nowrap;
    font-size: 11px;
}

.media-card__head-actions {
    display: flex;
    align-items: center;
    gap: 7px;
    flex: 0 0 auto;
}

.media-card__follow {
    min-width: 72px;
    height: 31px;
    padding: 0 12px;
    border: 0;
    border-radius: 8px;
    background: #eef2f6;
    color: #1f2937;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.media-card__follow.is-following {
    background: #e2e8f0;
    color: #475569;
}

.media-card__follow [data-follow-label-following],
.media-card__follow [data-follow-label-not-following] {
    display: none;
}

.media-card__follow.is-following [data-follow-label-following],
.media-card__follow:not(.is-following) [data-follow-label-not-following] {
    display: inline;
}

.media-card--fixed .media-card__menu {
    width: 28px;
    height: 31px;
    padding: 0;
    color: #4b5563;
    font-size: 17px;
}

.media-card__visual {
    width: 100%;
    height: 605px;
    min-height: 605px;
    overflow: hidden;
    background: #0b0f14;
}

.media-card__visual .media-gallery-wrap,
.media-card__visual .media-gallery,
.media-card__visual .media-gallery__viewport,
.media-card__visual .media-gallery__track,
.media-card__visual .media-gallery__slide {
    width: 100%;
    height: 100%;
    min-height: 0;
    max-height: none;
}

.media-card__visual .media-gallery {
    margin: 0;
    border-radius: 0;
    aspect-ratio: auto !important;
    background: #0b0f14;
}

.media-card__visual .media-gallery__slide img {
    width: 100%;
    height: 100%;
    min-height: 0;
    max-height: none;
    aspect-ratio: auto;
    object-fit: contain;
    object-position: center;
    background: #0b0f14;
}

.media-card__footer {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-height: 100px;
    overflow: hidden;
    background: var(--media-bg);
    padding-bottom: 0.35rem;
}

.media-card--fixed .media-card__actions {
    min-height: 48px;
    height: auto;
    padding: 2px 12px;
    gap: 18px;
}

.media-card--fixed .media-card__action {
    font-size: 13px;
    min-width: 48px;
    min-height: 48px;
}

.media-card--fixed .media-card__action i {
    font-size: 24px;
}

.media-card--fixed .media-card__action--bookmark {
    margin-right: auto;
}

.media-card__action--bookmark.is-saved {
    color: #2563eb;
}

.media-page-title {
    margin: 0;
    font-size: 1rem;
}

.media-manage,
.media-viewers {
    width: min(100%, 760px);
    margin: 0 auto;
    padding: 1rem;
}

.media-manage section {
    margin-bottom: 2rem;
}

.media-manage__item,
.media-viewer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--media-border);
}

.media-manage__item p,
.media-viewer small {
    display: block;
    margin: .35rem 0 0;
    color: #64748b;
}

.media-manage__actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .65rem;
}

.media-manage__actions form {
    display: flex;
    gap: .5rem;
}

.media-manage__actions button {
    color: #b91c1c;
}

.media-viewer img,
.media-viewer > span {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
}

.media-viewer > span {
    display: grid;
    place-items: center;
    background: #e2e8f0;
}

.media-viewer div {
    flex: 1;
}

.media-card__footer-caption-wrap {
    padding: 3px 12px 7px;
}

.media-card__footer-caption {
    overflow: hidden;
    padding: 0;
    margin: 0;
    color: var(--media-text);
    font-size: 12px;
    line-height: 19px;
    white-space: pre-line;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.media-card__footer-caption-more {
    display: inline-block;
    margin-top: 0.05rem;
    color: var(--media-text-muted);
    font-size: 11px;
    font-weight: 400;
    line-height: 1.35;
    text-decoration: none;
}

.media-card__footer-caption-more:hover {
    color: var(--media-primary);
}

.media-feed--profile {
    padding-top: 0.5rem;
}

.media-saved {
    width: min(100%, var(--media-feed-desktop, 630px));
    margin: 0 auto;
    padding: 0 0 1.5rem;
}

.media-saved-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.media-saved-grid__item {
    margin: 0;
    min-width: 0;
}

.media-saved-grid__thumb {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    padding: 0;
    border: 0;
    background: #e5e7eb;
    cursor: pointer;
    overflow: hidden;
}

.media-saved-grid__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.media-saved-grid__badge {
    position: absolute;
    top: 0.4rem;
    left: 0.4rem;
    width: 1.35rem;
    height: 1.35rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.25rem;
    background: rgba(15, 23, 42, 0.55);
    color: #fff;
    font-size: 0.7rem;
}

.media-saved-grid__thumb:focus-visible {
    outline: 2px solid var(--media-primary);
    outline-offset: -2px;
}

@media (min-width: 992px) {
    .media-feed {
        align-items: center;
        gap: 1rem;
    }

    .media-card.media-card--fixed {
        border-right: 1px solid var(--media-border);
        border-left: 1px solid var(--media-border);
    }
}

/* ── Instagram-style comments (threads, mentions, sheet) ── */
.media-card__comment-previews {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0 12px;
}

.media-card__comment-preview,
.media-card__view-comments {
    border: 0;
    background: transparent;
    padding: 0;
    text-align: right;
    font: inherit;
    font-size: 13px;
    line-height: 1.45;
    color: var(--media-text);
    cursor: pointer;
}

.media-card__comment-preview strong {
    font-weight: 700;
    margin-left: 0.35rem;
}

.media-card__view-comments {
    color: var(--media-text-muted);
    font-size: 12px;
    padding: 0 12px 0.15rem;
}

.media-comment-thread__replies {
    margin: 0.35rem 2rem 0 0;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.media-comment--reply .media-comment__avatar {
    width: 2.5rem;
    height: 2.5rem;
    flex-basis: 2.5rem;
    font-size: 0.72rem;
}

.media-comment__main {
    flex: 1;
    min-width: 0;
}

.media-comment__bubble {
    display: inline-block;
    max-width: 100%;
}

.media-comment__meta-line {
    display: inline;
    font-size: 0.84rem;
    line-height: 1.55;
}

.media-comment__author {
    font-weight: 700;
    color: var(--media-text);
    text-decoration: none;
    margin-left: 0.35rem;
}

a.media-comment__author {
    color: var(--media-primary);
}

a.media-comment__author:hover {
    text-decoration: underline;
}

.media-comment__reply-to {
    color: var(--media-text-muted);
    font-size: 0.78rem;
    margin-left: 0.35rem;
}

.media-comment__mention {
    color: var(--media-primary);
    font-weight: 600;
    text-decoration: none;
}

.media-comment__content {
    color: var(--media-text);
    white-space: pre-wrap;
    word-break: break-word;
}

.media-comment__actions-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.2rem;
}

.media-comment__reply-btn {
    border: 0;
    background: transparent;
    min-height: 44px;
    min-width: 44px;
    padding: 0.55rem 0.35rem;
    margin: -0.55rem -0.35rem;
    font: inherit;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--media-text-muted);
    cursor: pointer;
}

.media-comment__aside {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
    flex: 0 0 auto;
    min-width: 2.75rem;
}

.media-comment__like {
    border: 0;
    background: transparent;
    color: var(--media-text-muted);
    font-size: 0.85rem;
    min-width: 44px;
    min-height: 44px;
    padding: 0.55rem;
    margin: -0.35rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.media-comment__like.is-liked {
    color: #ef4444;
}

.media-comment__likes-count {
    font-size: 0.62rem;
    color: var(--media-text-muted);
    line-height: 1;
}

.media-comment-thread__toggle {
    border: 0;
    background: transparent;
    margin: 0.15rem 2.4rem 0.35rem 0;
    padding: 0;
    font: inherit;
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--media-text-muted);
    cursor: pointer;
}

.media-comments--sheet .media-comments__list {
    max-height: none;
    flex: 1;
    min-width: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-x: none;
}

.media-comments--sheet {
    display: flex;
    flex-direction: column;
    flex: 1;
    width: 100%;
    min-width: 0;
    min-height: 0;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

.media-comments--sheet .media-comments__composer-wrap {
    position: static;
    inset: auto;
    z-index: auto;
    max-width: none;
    margin: 0;
    flex-shrink: 0;
    box-shadow: none;
    border-top: 1px solid var(--media-border);
    padding: 0.55rem 0.85rem calc(0.55rem + env(safe-area-inset-bottom));
}

.media-comments__sheet-head {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 2.75rem;
    border-bottom: 1px solid var(--media-border);
}

.media-comments__input-wrap {
    position: relative;
    flex: 1;
    min-width: 0;
}

.media-comments__mention-list {
    position: absolute;
    right: 0;
    left: 0;
    bottom: calc(100% + 0.35rem);
    z-index: 5;
    max-height: 12rem;
    overflow-y: auto;
    border: 1px solid var(--media-border);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
}

.media-comments__mention-item {
    display: block;
    width: 100%;
    border: 0;
    border-bottom: 1px solid var(--media-border);
    background: #fff;
    padding: 0.65rem 0.85rem;
    text-align: right;
    font: inherit;
    font-size: 0.82rem;
    cursor: pointer;
}

.media-comments__reply-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
    padding: 0.35rem 0.65rem;
    border-radius: 10px;
    background: #f3f4f6;
    font-size: 0.78rem;
    color: var(--media-text-muted);
}

.media-comments__reply-banner button {
    border: 0;
    background: transparent;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
}

.media-comment-sheet {
    position: fixed;
    inset: 0;
    z-index: 1250;
}

.media-comment-sheet[hidden] {
    display: none;
}

.media-comment-sheet-open {
    overflow: hidden;
}

.media-comment-sheet__backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    background: rgba(15, 23, 42, 0.36);
    cursor: pointer;
}

.media-comment-sheet__panel {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    min-height: 78dvh;
    max-height: 92dvh;
    overflow-x: hidden;
    border-radius: 18px 18px 0 0;
    background: var(--media-bg);
    box-shadow: 0 -16px 40px rgba(15, 23, 42, 0.22);
}

.media-comment-sheet__handle {
    width: 2.5rem;
    height: 0.22rem;
    margin: 0.45rem auto 0;
    border-radius: 999px;
    background: #d1d5db;
}

.media-comment-sheet__close {
    position: absolute;
    top: 0.55rem;
    left: 0.75rem;
    z-index: 2;
    width: 2rem;
    height: 2rem;
    border: 0;
    border-radius: 999px;
    background: transparent;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
}

.media-comment-sheet__body {
    flex: 1;
    width: 100%;
    min-width: 0;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: hidden;
    display: flex;
    flex-direction: column;
}

.media-comment-sheet__loading {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--media-text-muted);
}

@media (min-width: 992px) {
    .media-comment-sheet__panel {
        right: 50%;
        left: auto;
        width: min(100%, var(--media-feed-desktop));
        transform: translateX(50%);
    }
}

.media-share-sheet {
    position: fixed;
    inset: 0;
    z-index: 1280;
}

.media-share-sheet[hidden] {
    display: none;
}

.media-share-sheet-open {
    overflow: hidden;
}

.media-share-sheet__backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    background: rgba(15, 23, 42, 0.36);
    cursor: pointer;
}

.media-share-sheet__panel {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    padding: 0 0 1rem;
    border-radius: 18px 18px 0 0;
    background: var(--media-bg);
    box-shadow: 0 -16px 40px rgba(15, 23, 42, 0.22);
}

.media-share-sheet__handle {
    width: 2.5rem;
    height: 0.22rem;
    margin: 0.45rem auto 0;
    border-radius: 999px;
    background: #d1d5db;
}

.media-share-sheet__header {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 3.2rem;
    padding: 0 3rem;
    border-bottom: 1px solid var(--media-border);
}

.media-share-sheet__header h2 {
    margin: 0;
    color: var(--media-text);
    font-size: 0.95rem;
    font-weight: 700;
}

.media-share-sheet__close {
    position: absolute;
    top: 0.65rem;
    left: 0.75rem;
    width: 2rem;
    height: 2rem;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--media-text);
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
}

.media-share-sheet__actions {
    display: flex;
    flex-direction: column;
    padding: 0.4rem 0;
}

.media-share-sheet__action {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    min-height: 3.2rem;
    padding: 0 1rem;
    border: 0;
    background: transparent;
    color: var(--media-text);
    font: inherit;
    font-size: 0.9rem;
    text-align: right;
    cursor: pointer;
}

.media-share-sheet__action i {
    width: 1.4rem;
    color: var(--media-text-muted);
    text-align: center;
}

.media-share-sheet__action:hover,
.media-share-sheet__action:focus-visible {
    background: color-mix(in srgb, var(--media-primary) 8%, transparent);
}

.media-share-sheet__status {
    min-height: 1.2rem;
    margin: 0;
    padding: 0 1rem;
    color: var(--media-text-muted);
    font-size: 0.78rem;
    text-align: center;
}

@media (min-width: 992px) {
    .media-share-sheet__panel {
        right: 50%;
        left: auto;
        width: min(100%, 420px);
        transform: translateX(50%);
    }
}

.media-post-light-sheet {
    position: fixed;
    inset: 0;
    z-index: 1260;
}

.media-post-light-sheet[hidden] {
    display: none;
}

.media-post-light-sheet-open {
    overflow: hidden;
}

.media-post-light-sheet__panel {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    max-width: none;
    min-height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
    border-radius: 0;
    background: var(--media-bg);
    box-shadow: none;
}

.media-post-light-sheet__toolbar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 2.75rem;
    padding: 0.35rem 0.75rem;
    padding-top: calc(0.35rem + env(safe-area-inset-top));
    pointer-events: none;
}

.media-post-light-sheet__close {
    pointer-events: auto;
    width: 2.25rem;
    height: 2.25rem;
    border: 0;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.45);
    color: #fff;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
}

.media-post-light-sheet__counter {
    pointer-events: none;
    margin-right: auto;
    margin-left: 0.75rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.45);
    color: #fff;
    font-size: 0.75rem;
}

.media-post-light-sheet__nav {
    position: absolute;
    top: 50%;
    z-index: 5;
    width: 3rem;
    height: 3rem;
    margin-top: -1.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.5);
    color: #fff;
    cursor: pointer;
}

.media-post-light-sheet__nav:disabled {
    opacity: 0.4;
    cursor: wait;
}

.media-post-light-sheet__nav--prev {
    right: 0.55rem;
}

.media-post-light-sheet__nav--next {
    left: 0.55rem;
}

.media-post-light-sheet__body {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding-top: calc(2.75rem + env(safe-area-inset-top));
}

.media-post-light-sheet__loading {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--media-text-muted);
}

.media-post-light {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.media-post-light__top {
    flex-shrink: 0;
}

.media-post-light__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.35rem 0.85rem 0.55rem;
    border-bottom: 1px solid var(--media-border);
}

.media-post-light__user {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
    color: inherit;
    text-decoration: none;
}

.media-post-light__user img,
.media-post-light__avatar-fallback {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    flex-shrink: 0;
    object-fit: cover;
}

.media-post-light__avatar-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e8effc;
    color: var(--media-primary);
    font-weight: 700;
}

.media-post-light__user-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.media-post-light__user-meta strong {
    font-size: 0.88rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.media-post-light__handle {
    font-size: 0.76rem;
    color: var(--media-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.media-post-light__time {
    flex-shrink: 0;
    font-size: 0.74rem;
    color: var(--media-text-muted);
}

.media-post-light__media {
    background: #0f172a;
}

.media-post-light__gallery {
    width: 100%;
    max-height: min(42dvh, 460px);
    aspect-ratio: 4 / 5;
}

.media-post-light__actions {
    padding: 0.25rem 0.85rem 0.15rem;
    margin: 0;
}

.media-post-light__scroll {
    flex: 1;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.media-post-light__caption {
    padding: 0.45rem 0.85rem 0.35rem;
    font-size: 0.86rem;
    line-height: 1.5;
}

.media-post-light__caption-user {
    display: inline;
    font-weight: 700;
    margin-left: 0.35rem;
    color: var(--media-primary);
    text-decoration: none;
}

.media-post-light__caption-user:hover {
    text-decoration: underline;
}

.media-post-light__caption .media-caption-text {
    display: block;
    margin: 0.35rem 0 0;
    white-space: pre-wrap;
    word-break: break-word;
}

.media-comments--light {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    margin: 0;
    padding: 0;
    border-top: 1px solid var(--media-border);
}

.media-comments--light .media-comments__list {
    overflow: visible;
    max-height: none;
    padding: 0.35rem 0.85rem 0.5rem;
}

.media-comments--light .media-comments__more-wrap {
    padding: 0 0.85rem 0.5rem;
}

.media-comments--light .media-comments__composer-wrap {
    position: static;
    inset: auto;
    z-index: auto;
    flex-shrink: 0;
    max-width: none;
    margin: 0;
    box-shadow: 0 -6px 18px rgba(26, 45, 95, 0.06);
    border-top: 1px solid var(--media-border);
    background: var(--media-bg);
    padding: 0.55rem 0.85rem calc(0.55rem + env(safe-area-inset-bottom));
}

@media (min-width: 992px) {
    .media-post-light-sheet__panel {
        inset: 0;
        width: 100%;
        transform: none;
        border-radius: 0;
        box-shadow: none;
    }

    .media-post-light {
        max-width: min(100%, 720px);
        margin: 0 auto;
        width: 100%;
    }

    .media-post-light__gallery {
        max-height: min(48dvh, 520px);
    }

    .media-post-light-sheet__nav--prev {
        right: max(1rem, calc(50% - 380px));
    }

    .media-post-light-sheet__nav--next {
        left: max(1rem, calc(50% - 380px));
    }
}
