/* ===== SPLIT LAYOUT ===== */
.layout {
    display: flex;
    height: calc(100vh - 100px);
    width: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

.panel {
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding-right: 4px;
    overscroll-behavior: auto;
}

.left {
    flex: 1 1 auto;
    min-width: 300px;
    padding: 10px 10%;    /* ← X% от ширины экрана */
    overflow-y: auto;
    overflow-x: hidden;
    height: 100%;
    overscroll-behavior: auto;
}

.right {
    flex: 0 0 40%;
    min-width: 0;
    background: black;
    position: relative;
    overflow: hidden;
}
.right.hidden {
    flex: 0 0 0 !important;
    width: 0 !important;
    min-width: 0 !important;
    opacity: 0;
    pointer-events: none;
}

.resizer {
    width: 8px;
    min-width: 8px;
    cursor: col-resize;
    background: #00ff88;
    opacity: 0.3;
    flex-shrink: 0;
    z-index: 10;
}
.resizer:hover {
    opacity: 0.8;
}
.resizer.hidden {
    width: 0 !important;
    min-width: 0 !important;
    opacity: 0;
    pointer-events: none;
}

.grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    align-items: stretch;
    max-width: 1200px;
    margin: 0 auto;
}

/* ===== МОБИЛЬНАЯ ВЕРСИЯ ===== */
@media (max-width: 768px) {
    .layout {
        flex-direction: column;
        height: auto !important;
        min-height: 100vh;
        gap: 8px;
        overflow: visible !important;
        padding: 0 8px;
        width: 100%;
        max-width: 100%;
        margin: 0;
    }
    .panel {
        height: auto !important;
        overflow-y: visible !important;
        -webkit-overflow-scrolling: auto;
        padding-right: 0;
    }
    .left {
        flex: 1 1 auto !important;
        min-width: 0 !important;
        padding: 10px 16px !important;
        width: 100% !important;
        overflow-y: visible !important;
        height: auto !important;
        padding-bottom: 20px;
    }

    .grid {
        max-width: 100%;
        margin: 0;
    }

    .right {
        flex: 0 0 auto !important;
        min-width: 100% !important;
        width: 100% !important;
        height: 40vh;
        min-height: 300px;
        opacity: 1 !important;
        pointer-events: auto !important;
        overflow: hidden;
        flex-shrink: 0;
    }
    .right.hidden {
        display: none !important;
        flex: 0 0 0 !important;
        height: 0 !important;
        min-height: 0 !important;
    }
    .resizer {
        display: none !important;
    }
}

@media (max-width: 480px) {
    .layout {
        min-height: 100vh;
        gap: 6px;
    }
    .right {
        height: 35vh;
        min-height: 200px;
    }
}

/* ===== АЛЬБОМНАЯ ОРИЕНТАЦИЯ ===== */
@media (max-width: 768px) and (orientation: landscape) {
    .layout {
        flex-direction: row;
        height: calc(100vh - 80px) !important;
        min-height: auto;
        overflow: hidden !important;
    }
    .left {
        flex: 1 1 60% !important;
        min-width: 0 !important;
        padding-right: 8px;
        overflow-y: auto !important;
        height: 100% !important;
    }
    .right {
        flex: 0 0 40% !important;
        min-width: 0 !important;
        height: 100% !important;
        min-height: 0;
    }
    .grid {
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }
    .wide {
        grid-column: span 2;
    }
}