.palette-wrapper{
    margin: 0 auto;
    padding: 0 6px;
    box-sizing: border-box;
    text-align: center;
}
.palette-grid{
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2px;
    margin: 10px 0;
}
.palette-item{
    cursor: pointer;
    text-align: center;
    padding: 6px;
}
.palette-item img{
    width: 100%;
    aspect-ratio: 1/1;
    object-fit: cover;
    display: block;
    border-radius: 12px;
    transition: transform .2s ease;
}
.palette-item:hover img{
    transform: scale(1.04);
}

/* === НАЗВАНИЕ === */
.palette-title{
    margin-top: 8px;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

/* === СУПЕР МАЛЕНЬКИЕ === */
@media (max-width: 380px){
    .palette-grid{
        grid-template-columns: 1fr;
    }
    .palette-title{
        font-size: 17px;
    }
}

/* === ПЛАНШЕТ / ДЕСКТОП === */
@media (min-width: 640px){
    .palette-grid{
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
        gap: 4px;
    }
    .palette-item{
        padding: 8px;
    }
    .palette-item img{
        border-radius: 10px;
    }
    .palette-title{
        font-size: 15px;
        font-weight: 500;
        margin-top: 10px;
    }
}

/* === POPUP === */
.palette-popup{
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 99999;
    padding: 20px;
    box-sizing: border-box;
}
.palette-popup.active{
    display: flex;
}
.palette-popup-content{
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.palette-popup img{
    max-width: 100%;
    max-height: 85vh;
    border-radius: 14px;
    background: #fff;
    box-shadow:
        0 20px 60px rgba(0,0,0,.18),
        0 2px 10px rgba(0,0,0,.08);
    opacity:1;
    transition:opacity .25s ease;
}
.palette-popup img.fade{
    opacity:0;
}
.palette-popup-title{
    font-size: 16px;
    font-weight: 500;
    color: #222;
    text-align: center;
    background: rgba(255,255,255,.85);
    padding: 6px 12px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,.08);
}

/* === КРЕСТИК === */
.palette-close{
    position: absolute;
    top: 12px;
    right: 12px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 34px;
    font-weight: 600;
    line-height: 1;
    color: #222;
    border-radius: 50%;
    background: rgba(255,255,255,.95);
    box-shadow: 0 4px 12px rgba(0,0,0,.12);
}

/* === СТРЕЛКИ (СИЛЬНЕЕ, НО ТАКОГО ЖЕ РАЗМЕРА) === */
.palette-arrow{
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    z-index: 100000;
    border-radius: 50%;
    background: rgba(255,255,255,.95);
    color: #000;
    font-size: 36px;
    font-weight: 700;
    line-height: 1;
    box-shadow:
        0 6px 16px rgba(0,0,0,.18),
        inset 0 0 0 1px rgba(0,0,0,.05);
    transition: all .2s ease;
}
/* идеальный центр */
.palette-arrow::before{
    transform: translateY(-1px);
}
/* hover */
.palette-arrow:hover{
    transform: translateY(-50%) scale(1.08);
    box-shadow: 0 10px 24px rgba(0,0,0,.22);
}
/* active */
.palette-arrow:active{
    transform: translateY(-50%) scale(0.95);
}
.palette-prev{ left: 12px; }
.palette-next{ right: 12px; }

/* === МОБИЛКА &mdash; ВНИЗ === */
@media (max-width: 640px){
    .palette-popup-content{
        position: relative;
        padding-bottom: 60px;
    }
    .palette-arrow{
        top: auto;
        bottom: 8px;
        transform: none;

        font-size: 30px;
    }
    .palette-prev{
        left: 16px;
    }
    .palette-next{
        right: 16px;
    }
    .palette-arrow:hover{
        transform: scale(1.08);
    }
    .palette-arrow:active{
        transform: scale(0.95);
    }
    .palette-popup-title{
        margin-bottom: 32px;
    }
}
