@media (max-width: 767px) and (orientation: landscape) {
    .community-avatar-section {
        flex-direction: row;
        text-align: left;
        align-items: flex-start;
    }

    .community-details {
        text-align: left;
        align-items: flex-start;
    }

    .community-meta {
        justify-content: flex-start;
    }

    .community-actions {
        justify-content: flex-start;
        flex-direction: row;
    }

    .community-cover {
        height: 180px;
    }

    .community-stats {
        justify-content: flex-start;
    }

    .community-sidebar-wrapper {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }

    .create-post-actions {
        flex-direction: row;
    }

    .post-attachments {
        display: flex;
        flex-wrap: wrap;
        width: auto;
    }

    .post-options {
        flex-direction: row;
        width: auto;
    }

    .visibility-dropdown {
        width: auto;
    }

    .poll-settings-row {
        flex-direction: row;
    }

    .comments-list {
        max-height: 200px;
    }

    .comment-replies {
        margin-left: 28px;
    }

    .comment-replies .comment-replies {
        margin-left: 20px;
    }

    /* Story modal */
    .story-modal {
        align-items: center;
        padding: 0.5rem;
    }

    .story-modal-content {
        max-height: 95vh;
        border-radius: 20px;
    }

    .story-modal-header::before {
        display: none;
    }

    .story-modal-header h3 {
        margin-top: 0;
    }

    .modal-close {
        margin-top: 0;
    }

    .story-preview-wrapper {
        max-height: 300px;
        padding-bottom: 100%;
    }

    .story-options {
        flex-direction: row;
        flex-wrap: wrap;
    }

    /* Лайтбокс аудио — горизонтальная компоновка */
    .lightbox-audio-container {
        flex-direction: row;
        width: auto;
        max-width: 90vw;
        gap: 1rem;
        padding: 1rem 1.5rem;
    }

    .lightbox-audio-container .audio-visualization {
        width: 60px;
        height: 60px;
        flex-shrink: 0;
    }

    .lightbox-audio-container .modern-audio-player {
        flex: 1;
        min-width: 0;
    }

    .lightbox-audio-container .audio-title {
        text-align: left;
    }
}

/* ===== ПЛАНШЕТЫ — ПОРТРЕТНАЯ ОРИЕНТАЦИЯ ===== */
@media (min-width: 768px) and (max-width: 991px) and (orientation: portrait) {
    .community-sidebar-wrapper {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }
}

/* ===== БОЛЬШИЕ ТЕЛЕФОНЫ (400-575px) — уточнение аватара ===== */
@media (min-width: 400px) and (max-width: 575px) {
    .community-avatar,
    .community-avatar-placeholder {
        width: 90px;
        height: 90px;
    }
}

/* ===== ДЕСКТОП — скрытие мобильного volume ===== */
@media (min-width: 768px) {
    .clips-header-volume {
        display: none;
    }
}

/* ===== TOUCH / СЕНСОРНЫЕ ЭКРАНЫ ===== */
@media (hover: none) and (pointer: coarse) {
    /* Минимальные размеры touch-целей */
    .comment-reply-btn,
    .comment-edit-btn,
    .comment-delete-btn {
        min-height: 36px;
        min-width: 44px;
        padding: 0.375rem 0.5rem;
    }

    .comment-action-btn {
        min-width: 36px;
        min-height: 36px;
    }

    .comment-submit,
    .comment-reply-submit {
        min-width: 40px;
        min-height: 40px;
    }

    /* Hover-зависимые элементы всегда видимы */
    .comment-actions {
        display: flex;
    }

    .album-photo-remove,
    .album-menu-btn,
    .article-menu-btn,
    .clip-nav-btn {
        opacity: 1;
    }

    .audio-progress-handle {
        transform: translate(-50%, -50%) scale(1.2);
    }

    .volume-slider::-webkit-slider-thumb {
        width: 16px;
        height: 16px;
    }

    .volume-slider::-moz-range-thumb {
        width: 16px;
        height: 16px;
    }

    /* Story modal */
    .story-upload-area {
        min-height: 160px;
    }

    .modal-close,
    .story-preview-play-btn,
    .story-preview-volume,
    .story-fit-toggle {
        min-width: 44px;
        min-height: 44px;
    }

    .story-modal-footer .btn {
        min-height: 44px;
    }

    /* Лайтбокс touch */
    .lightbox-audio-container .audio-play-btn {
        min-width: 44px;
        min-height: 44px;
    }

    .lightbox-audio-container .volume-btn {
        min-width: 36px;
        min-height: 36px;
    }

    .lightbox-audio-container .audio-progress-handle {
        transform: translate(-50%, -50%) scale(1.3);
    }
}

/* ===== РЕТИНА ДИСПЛЕИ ===== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .community-avatar,
    .community-avatar-placeholder,
    .subscriber-avatar,
    .subscriber-avatar-placeholder,
    .post-author-avatar,
    .post-author-placeholder,
    .comment-avatar,
    .comment-avatar-placeholder,
    .story-user-avatar,
    .story-user-avatar-placeholder,
    .clip-author-avatar,
    .clip-author-placeholder {
        border-width: 2px;
    }
}

/* ===== ПЕЧАТЬ ===== */
@media print {
    .community-actions,
    .create-post-card,
    .post-interaction-bar,
    .post-comments,
    .community-media-gallery,
    .community-sidebar-wrapper,
    .content-layout .community-sidebar {
        display: none;
    }

    .content-layout {
        display: block;
    }

    .community-page {
        background: white;
    }

    .community-header {
        box-shadow: none;
        border: 1px solid #eee;
    }

    .post-card {
        page-break-inside: avoid;
        margin-bottom: 2rem;
        border: 1px solid #eee;
    }
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
    .story-modal-content,
    .story-modal.closing .story-modal-content {
        animation: none;
    }

    .story-upload-area::before {
        animation: none;
    }

    .modern-audio-player.playing .audio-play-btn {
        animation: none;
    }

    .online-indicator {
        animation: none;
    }

    * {
        transition-duration: 0.01ms !important;
    }
}

/* ===== REDUCED DATA ===== */
@media (prefers-reduced-data: reduce) {
    .story-upload-area::before {
        display: none;
    }

    .story-modal-content {
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    }
}

/* ===== iOS SAFE AREA ===== */
@supports (-webkit-touch-callout: none) {
    .story-modal-content {
        padding-bottom: env(safe-area-inset-bottom);
    }

    .story-modal-footer {
        padding-bottom: calc(1rem + env(safe-area-inset-bottom));
    }

    .clip-comments-panel .clip-comment-input-wrapper {
        padding-bottom: calc(16px + env(safe-area-inset-bottom));
    }

    .modal-footer {
        padding-bottom: calc(1rem + env(safe-area-inset-bottom));
    }
}
