select {
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 14px;
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: .2s;
    outline: none;
}

select:hover {
    border-color: var(--accent);
}

select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 30%, transparent);
}

.controls .row {
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: normal;
}

.controls select {
    min-width: 0;
    flex: 1 1 auto;
}

.controls .row div {
    font-size: 14px;
    color: var(--muted);
    flex-shrink: 0;
}

.controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.controls > :nth-last-child(1) {
    grid-column: span 2;
}

@media (max-width: 768px) {
    select {
        width: 100%;
        font-size: 13px;
        padding: 6px 10px;
        border-radius: 8px;
    }

    .controls .row div {
        font-size: 16px;
    }

    .controls .row {
        gap: 6px;
    }
}

@media (max-width: 890px) {
    .controls {
        grid-template-columns: 1fr;
    }

    .controls > :nth-last-child(1) {
        grid-column: span 1;
    }
}

.color-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

.control-divider {
    width: 1px;
    background: var(--border);
    margin: 0 8px;
}

.color-preview {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #fff;
    cursor: pointer;
}

.color-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .55);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.color-modal-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 16px;

    width: min(520px, 80vw);
    max-width: 80vw;
    max-height: 85vh;

    display: flex;
    flex-direction: column;

    box-shadow: 0 30px 80px rgba(0, 0, 0, .45);
}

.color-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    min-width: 0;
}

.color-modal-header .title {
    flex: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.color-modal-header button {
    flex: 0 0;
    margin-left: 8px;
    background: transparent;
    border: none;
    color: var(--muted);
    font-size: 18px;
    cursor: pointer;
}

.color-modal-body {
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;

    padding-right: 4px;
}

.color-modal-body::after {
    content: "";
    display: block;
    height: 12px;
}

body.modal-open {
    overflow: hidden;
}

.colors-list {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 14px;
}

.colors-list > * {
    min-width: 0;
}

.preset {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid var(--border);
}

.colors-title {
    font-size: 16px;
    color: var(--muted);
    margin-bottom: 6px;
}

.recent-slot, .fav-slot {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: transparent; /* изначально пусто */
    cursor: pointer;
}

.color-cell {
    position: relative;
    aspect-ratio: 1;
    border-radius: 6px;
    border: 1px solid var(--border);
    cursor: pointer;
}

.heart {
    position: absolute;
    top: 4px;
    right: 4px;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    transition: transform .15s ease, color .15s ease, opacity .15s ease;
}

.heart:hover {
    color: #ff4d4d;
    -webkit-text-stroke-width: 2px; -webkit-text-stroke-color: #ff4d4d
}

.heart-outline {
    color: rgba(255, 255, 255, 0.4);
}

.heart-active {
    color: #ff4d4d;
    /*text-shadow: -1px -1px 0 black, 1px -1px 0 black, -1px 1px 0 black, 1px 1px 0 black;*/
    -webkit-text-stroke-width: 2px; -webkit-text-stroke-color: black
}

@keyframes shake {
    0% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-4px);
    }
    50% {
        transform: translateX(4px);
    }
    75% {
        transform: translateX(-4px);
    }
    100% {
        transform: translateX(0);
    }
}

.shake {
    animation: shake 0.25s ease;
}

#colorPicker {
    width: 100%;
    height: 42px;
    border: none;
    background: transparent;
    cursor: pointer;
    margin-bottom: 10px;
}

.color-cell,
.recent-slot,
.fav-slot,
.preset {
    border-radius: 8px;
    min-height: 44px;
}

@media (max-width: 520px) {
    .colors-list {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (pointer: coarse) {

    .heart:hover {
        color: rgba(255, 255, 255, .4);
        background: transparent;
    }
}
