/* --- Cells & Blocks --- */

/* 1. Пустая ячейка доски */
.cell {
    background-color: var(--cell-empty);
    /* [ИЗМЕНЕНИЕ] Делаем квадратными (было 10px) */
    border-radius: 2px; 
    width: 100%;
    height: 100%;
    position: relative;
    border: none; 
    transform: translateZ(0); 
}

/* 
   2. ЖИДКОЕ СТЕКЛО (Оптимизированное)
*/
.cell[class*="color-"] {
    background-color: rgba(var(--rgb), 0.85) !important;

    background-image: linear-gradient(
        135deg, 
        rgba(255, 255, 255, 0.4) 0%, 
        rgba(255, 255, 255, 0.1) 50%, 
        rgba(0, 0, 0, 0.05) 100%
    ) !important;

    box-shadow: 
        inset 0 1px 1px rgba(255, 255, 255, 0.9), 
        inset 0 -2px 4px rgba(0, 0, 0, 0.2),
        0 2px 5px rgba(0, 0, 0, 0.2) !important;
    
    border: 1px solid rgba(255, 255, 255, 0.3);
    
    background-blend-mode: normal;
    z-index: 2;
}

/* 3. ПАЛИТРА */
.color-1 { --rgb: 255, 59, 48; }
.color-2 { --rgb: 255, 149, 0; }
.color-3 { --rgb: 255, 204, 0; }
.color-4 { --rgb: 52, 199, 89; }
.color-5 { --rgb: 48, 176, 199; }
.color-6 { --rgb: 0, 122, 255; }
.color-7 { --rgb: 175, 82, 222; }
.color-8 { --rgb: 255, 45, 85; }
.color-9 { --rgb: 142, 142, 147; }


/* --- MINI SHAPES --- */

.mini-shape {
    display: grid;
    gap: 2px;
}

.mini-shape .cell {
    /* [ИЗМЕНЕНИЕ] Почти острые углы для маленьких фигур */
    border-radius: 1px !important;
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.6) !important;
    border: 0.5px solid rgba(255, 255, 255, 0.3);
}

.mini-shape div:not([class*="color-"]) {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    opacity: 0;
}


/* --- PREVIEW & GHOST --- */

.cell-preview {
    background-color: rgba(255, 255, 255, 0.15) !important;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3);
    /* [ИЗМЕНЕНИЕ] Квадрат */
    border-radius: 2px;
    z-index: 10;
}

/* Подсветка очистки */
.cell.cell-will-clear {
    background-color: rgba(255, 255, 255, 0.5) !important;
    background-image: none !important;
    border: none !important;
    box-shadow: 
        0 0 10px 2px rgba(255, 255, 255, 0.3),
        inset 0 0 20px rgba(255, 255, 255, 0.5) !important;
    z-index: 100 !important;
    transform: scale(1.05) !important;
    transition: none;
    opacity: 1 !important;
}

.shape-ghost {
    position: fixed;
    top: 0; left: 0;
    z-index: 1000;
    pointer-events: none; 
    will-change: transform;
    display: none; 
    gap: 4px; 
}

.shape-ghost .cell {
    /* [ИЗМЕНЕНИЕ] Квадрат */
    border-radius: 2px;
    box-shadow: 
        0 10px 20px rgba(0,0,0,0.3),
        inset 0 1px 1px rgba(255,255,255,0.8) !important;
    transform: scale(1.02);
}


/* --- ANIMATIONS --- */

.cell.placed {
    animation: place-pop 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes place-pop {
    0% { transform: scale(0.5); opacity: 0; }
    80% { transform: scale(1.05); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

.cell.ghost-block {
    position: absolute !important;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 50; 
    pointer-events: none;
    will-change: transform, opacity;
    animation: ghost-pop-vanish 0.35s ease-in-out forwards;
}

@keyframes ghost-pop-vanish {
    0% {
        transform: scale(1);
        opacity: 1;
        filter: brightness(1);
    }
    30% {
        transform: scale(0.9);
        opacity: 1;
        filter: brightness(1.3);
    }
    100% {
        transform: scale(0.2);
        opacity: 0;
    }
}

.fill-anim {
    animation: pop-fill 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes pop-fill {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* --- Modals --- */
.overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 3000;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0,0,0,0.6);
    animation: fade-in 0.2s ease;
}

.modal-content {
    background: #1c1c1e;
    padding: 30px;
    border-radius: 24px;
    text-align: center;
    width: 80%;
    max-width: 320px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.7);
    border: 1px solid rgba(255,255,255,0.08);
}

.modal-content h2 {
    margin-top: 0;
    margin-bottom: 10px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes fade-in {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}