.videos-page {
    width: min(1500px, calc(100% - 24px));
    margin: 18px auto 30px;
    padding: 32px;
}

.video-page-shell {
    width: min(1500px, calc(100% - 24px));
    margin: 18px auto 30px;
}

.video-page-shell.has-video-ads {
    width: min(2100px, calc(100% - 24px));
    display: grid;
    grid-template-columns:
        clamp(90px, 20%, 340px)
        minmax(0, 1fr)
        clamp(90px, 20%, 340px);
    gap: 6px;
    align-items: start;
}

.video-page-main {
    min-width: 0;
}

.video-page-shell .videos-page {
    width: 100%;
    margin: 0;
}

.video-mobile-ad {
    display: none;
    grid-column: 1 / -1;
}

.videos-page__header,
.video-detail-page__topbar,
.video-form-page__topbar,
.video-comments-section__header,
.video-form__actions,
.video-comment-form__footer,
.video-card__meta,
.video-card__stats,
.video-detail-card__meta,
.video-detail-card__actions,
.dashboard-video-item__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.videos-page__header {
    align-items: flex-start;
    margin-bottom: 26px;
}

.videos-page__header h1,
.video-form-page__intro h1,
.video-detail-card h1,
.video-comments-section h2 {
    margin: 0;
}

.videos-page__eyebrow,
.video-card__eyebrow {
    margin: 0 0 7px;
    color: var(--primary);
    font-size: .74rem;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.videos-page__intro,
.video-form-page__intro p:last-child {
    max-width: 760px;
    margin: 10px 0 0;
    color: var(--txt-dim);
    line-height: 1.55;
}

.videos-filter {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(180px, 250px) auto;
    align-items: end;
    gap: 14px;
    margin-bottom: 22px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: color-mix(in srgb, var(--primary-soft), white 52%);
}

.videos-filter__field,
.video-form__field {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 7px;
}

.videos-filter__field label,
.video-form__field label,
.video-comment-form > label {
    font-size: .86rem;
    font-weight: 700;
    color: var(--txt-dim);
}

.videos-filter__input,
.video-form-input,
.video-comment-form__textarea {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #fff;
    outline: 0;
}

.videos-filter__input:focus,
.video-form-input:focus,
.video-comment-form__textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.videos-filter__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.videos-active-filter {
    margin: 0 0 18px;
    color: var(--txt-dim);
}

.video-ads {
    margin: 0 0 24px;
}

.video-ads__rotator {
    position: relative;
}

.video-ads__rotator .rotator-item {
    position: absolute;
    inset: 0;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(8px) scale(.99);
    transition: opacity .45s ease, transform .45s ease, visibility 0s linear .45s;
}

.video-ads__rotator .rotator-item.is-active {
    position: relative;
    z-index: 1;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
    transition: opacity .45s ease, transform .45s ease, visibility 0s linear 0s;
}

.video-ads__rotator .dashboard-ad-card {
    max-width: 100%;
}

.video-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
}

.video-card {
    display: flex;
    min-width: 0;
    overflow: hidden;
    flex-direction: column;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 8px 22px rgba(0, 0, 0, .08);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.video-card:hover {
    border-color: var(--primary);
    box-shadow: 0 12px 28px rgba(0, 0, 0, .13);
    transform: translateY(-2px);
}

.video-card__link {
    display: flex;
    flex: 1;
    min-height: 0;
    flex-direction: column;
    color: inherit;
}

.video-card__preview,
.dashboard-video-item__preview {
    position: relative;
    display: block;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    background: #111;
}

.video-card__preview img,
.video-card__preview iframe,
.dashboard-video-item__preview img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .25s ease, filter .25s ease;
}

.video-card__preview iframe {
    border: 0;
}

.video-card:hover .video-card__preview img,
.dashboard-video-item:hover .dashboard-video-item__preview img {
    filter: brightness(.78);
    transform: scale(1.035);
}

.video-card__play,
.dashboard-video-item__play {
    position: absolute;
    top: 50%;
    left: 50%;
    display: grid;
    width: 58px;
    height: 58px;
    place-items: center;
    border: 2px solid rgba(255, 255, 255, .85);
    border-radius: 50%;
    background: rgba(0, 0, 0, .56);
    color: #fff;
    font-size: 22px;
    transform: translate(-50%, -50%);
}

.video-card__youtube-badge {
    position: absolute;
    right: 10px;
    bottom: 10px;
    padding: 4px 8px;
    border-radius: 5px;
    background: #e62117;
    color: #fff;
    font-size: .7rem;
    font-weight: 800;
}

.video-card__body {
    display: flex;
    flex: 1;
    min-width: 0;
    min-height: 0;
    flex-direction: column;
    padding: 16px;
}

.video-card__body .video-card__eyebrow {
    margin-bottom: 5px;
    font-size: .65rem;
}

.video-card__title {
    display: -webkit-box;
    overflow: hidden;
    margin: 0 0 9px;
    color: var(--txt);
    font-size: 0.7rem;
    line-height: 1.28;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.video-card__description {
    display: -webkit-box;
    min-height: 7.1em;
    overflow: hidden;
    margin: 0;
    color: var(--txt-dim);
    font-size: .88rem;
    line-height: 1.42;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 5;
}

.video-card__meta,
.video-card__stats {
    justify-content: flex-start;
    flex-wrap: wrap;
    margin-top: auto;
    padding-top: 14px;
    color: var(--txt-dim);
    font-size: .76rem;
}

.video-card__stats {
    gap: 12px;
    margin-top: 0;
    padding-top: 9px;
    border-top: 1px solid color-mix(in srgb, var(--border), transparent 20%);
}

.video-card__meta,
.video-card__stats {
    flex-shrink: 0;
}

.videos-pager {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 26px;
}

.videos-pager__current {
    padding: 8px 12px;
    color: var(--txt-dim);
    font-weight: 700;
}

.videos-empty,
.video-comments-empty,
.video-login-prompt {
    padding: 34px 20px;
    border: 1px dashed var(--border);
    border-radius: 12px;
    background: color-mix(in srgb, var(--primary-soft), white 60%);
    text-align: center;
}

.videos-empty h2 {
    margin: 0 0 8px;
    font-size: 1.35rem;
}

.videos-empty p,
.video-comments-empty p,
.video-login-prompt p {
    margin: 0 0 16px;
    color: var(--txt-dim);
}

.video-detail-page__topbar,
.video-form-page__topbar {
    margin-bottom: 20px;
}

.video-detail-card {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 15px;
    background: #fff;
    box-shadow: 0 10px 28px rgba(0, 0, 0, .09);
}

.video-detail-page .video-player {
    position: relative;
    width: min(100%, 1000px);
    margin-inline: auto;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #050505;
}

.video-detail-page .video-player iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
}

.video-detail-card__body {
    padding: 24px;
}

.video-detail-card h1 {
    font-size: clamp(1.55rem, 3vw, 2.35rem);
    overflow-wrap: anywhere;
}

.video-detail-card__meta {
    justify-content: flex-start;
    flex-wrap: wrap;
    margin-top: 12px;
    color: var(--txt-dim);
    font-size: .86rem;
}

.video-detail-card__meta a,
.video-comment__header a,
.video-comment__reply-context a {
    color: var(--primary);
    font-weight: 700;
}

.video-detail-card__description {
    margin-top: 20px;
    color: var(--txt);
    line-height: 1.65;
}

.video-detail-card__actions {
    justify-content: flex-start;
    flex-wrap: wrap;
    margin-top: 22px;
}

.video-like-button,
.video-comment-like,
.video-comment-reply,
.video-login-like {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 38px;
    padding: 7px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    color: var(--txt-dim);
    cursor: pointer;
    font: inherit;
    font-size: .88rem;
    text-decoration: none;
}

.video-like-button:hover,
.video-comment-like:hover,
.video-comment-reply:hover,
.video-login-like:hover,
.video-like-button.is-liked,
.video-comment-like.is-liked {
    border-color: var(--primary);
    background: var(--primary-soft);
    color: var(--primary);
}

.video-like-button:disabled,
.video-comment-like:disabled {
    cursor: wait;
    opacity: .65;
}

.video-comments-link {
    color: var(--txt-dim);
    font-size: .9rem;
}

.video-comments-link:hover {
    color: var(--primary);
}

.video-comments-section {
    margin-top: 28px;
}

.video-comments-section__header {
    margin-bottom: 16px;
}

.video-comments-section__count {
    display: grid;
    min-width: 40px;
    height: 40px;
    place-items: center;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 800;
}

.video-comment-form {
    display: flex;
    flex-direction: column;
    gap: 9px;
    margin-bottom: 24px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: color-mix(in srgb, var(--primary-soft), white 60%);
}

.video-comment-form__textarea {
    min-height: 88px;
    resize: vertical;
}

.video-comment-form__footer {
    color: var(--txt-dim);
    font-size: .76rem;
}

.video-comment-form__reply-target {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    border-left: 3px solid var(--primary);
    background: #fff;
    color: var(--txt-dim);
    font-size: .85rem;
}

.video-comment-form__reply-target button {
    border: 0;
    background: transparent;
    color: var(--txt-dim);
    cursor: pointer;
}

.video-comments-list {
    display: flex;
    flex-direction: column;
    gap: 13px;
}

.video-comment {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
}

.video-comment--reply {
    margin-left: clamp(18px, 5vw, 58px);
    border-left: 3px solid var(--primary);
}

.video-comment__avatar img {
    display: block;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
}

.video-comment__header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
}

.video-comment__header time {
    margin-left: auto;
    color: var(--txt-dim);
    font-size: .75rem;
}

.video-comment__badges {
    display: inline-flex;
    gap: 4px;
}

.video-comment__badges .chip {
    height: 21px;
    padding: 0 6px;
    font-size: .68rem;
}

.video-comment__reply-context {
    margin-top: 7px;
    color: var(--txt-dim);
    font-size: .78rem;
}

.video-comment__content {
    margin-top: 10px;
    overflow-wrap: anywhere;
    line-height: 1.5;
}

.video-comment__actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 13px;
}

.video-comment-like,
.video-comment-reply {
    min-height: 31px;
    padding: 4px 9px;
    font-size: .78rem;
}

.video-form-page {
    max-width: 920px;
}

.video-form-page__intro {
    margin: 0 auto 28px;
    max-width: 720px;
    text-align: center;
}

.video-form-page__intro p:last-child {
    margin-right: auto;
    margin-left: auto;
}

.video-form {
    display: flex;
    max-width: 720px;
    margin: 0 auto;
    flex-direction: column;
    gap: 18px;
}

.video-form__field small {
    color: var(--txt-dim);
    font-size: .78rem;
}

.video-form__checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--txt);
    font-weight: 700;
}

.video-form-checkbox {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.video-form__errors {
    color: #a33a32;
    font-size: .84rem;
}

.video-form__errors ul {
    margin: 0;
    padding-left: 20px;
}

.video-form__actions {
    justify-content: flex-start;
    margin-top: 4px;
}

.dashboard-video-item {
    overflow: hidden;
}

.dashboard-video-item__preview {
    margin-top: 4px;
    border-radius: 10px;
}

.dashboard-video-item__body {
    padding-top: 13px;
}

.dashboard-video-item__body h3 {
    margin: 0 0 7px;
    font-size: 1.2rem;
}

.dashboard-video-item__body p {
    margin: 0;
    color: var(--txt-dim);
    line-height: 1.5;
}

.dashboard-video-item__footer {
    justify-content: flex-start;
    flex-wrap: wrap;
    margin-top: 14px;
    color: var(--txt-dim);
    font-size: .8rem;
}

.dashboard-video-item__footer a {
    margin-left: auto;
    color: var(--primary);
    font-weight: 700;
}

.chip-video {
    background: var(--primary-soft);
    color: var(--primary);
}

@media (max-width: 1500px) {
    .video-page-shell.has-video-ads .video-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 1180px) {
    .video-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 1100px) {
    .video-page-shell,
    .video-page-shell.has-video-ads {
        width: min(920px, calc(100% - 16px));
        display: block;
        margin-top: 8px;
    }

    .video-page-shell.has-video-ads .video-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .video-mobile-ad {
        display: block;
        width: 100%;
        min-width: 0;
    }

    .video-mobile-ad .dashboard-ad-card {
        width: 100%;
        max-width: none;
    }
}

@media (max-width: 760px) {
    .videos-page {
        width: min(100% - 12px, 680px);
        margin-top: 8px;
        /*padding: 20px 14px;*/
    }

    .videos-page__header {
        flex-direction: column;
    }

    .videos-page__add-button {
        width: 100%;
    }

    .videos-filter {
        grid-template-columns: 1fr;
        padding: 14px;
    }

    .videos-filter__actions {
        justify-content: flex-start;
    }

    .video-grid {
        grid-template-columns: 1fr;
    }

    .video-detail-card__body {
        padding: 18px 14px;
    }

    .video-comment__header time {
        width: 100%;
        margin-left: 0;
    }

    .video-comment-form__footer {
        align-items: flex-start;
        flex-direction: column;
    }

    .video-comment-form__footer .btn {
        width: 100%;
    }
}
