#numberOfPlayersButtonsDiv,
#randmozieAllButtonDiv{
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
}

#buildsTablesDiv,
#charactersAndBtnDiv,
#kartsAndBtnDiv,
#standartBikesAndBtnDiv,
#sportBikesAndBtnDiv,
#atvsAndBtnDiv,
#tiresAndBtnDiv,
#glidersAndBtnDiv{
    width: 100%;
    box-sizing: border-box;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

#buildsTablesDiv{ 
    display: grid;
    flex: 0 0 auto; 
    grid-template-columns: repeat(var(--player-columns, 1), minmax(0, 1fr)); 
    align-content: start; 
    align-items: start; 
    gap: 24px; 
    overflow: visible; 
}

#buildsTablesDiv.singleColumnBuildLayout .buildPlayerPanel{
    width: min(100%, 1100px);
    justify-self: center;
    height: auto;
}

#buildsTablesDiv.singleColumnBuildLayout{
    flex: 0 0 auto;
    align-content: start;
    align-items: start;
}

#buildDiv.singleColumnBuildLayout{
    min-height: auto;
}


#buildTableAndBtnDiv{
    display: flex;
    align-items: center;
}

#siteBorderDiv{
    position: relative;
    border: 8px solid transparent;
    border-radius: 50px;
    background: linear-gradient(45deg,rgb(45, 129, 255), rgb(229, 99, 255));
    background-clip: padding-box;
    padding: 10px;
    /* just to show box-shadow still works fine */
    box-shadow: 0 3px 9px black, inset 0 0 9px white;

    width: min(90%, 1400px);
    box-sizing: border-box;
    padding-left: clamp(10px, 4vw, 50px); padding-right: clamp(10px, 4vw, 50px);
    margin:auto;
}

#siteBorderDiv:after{
    position: absolute;
    top: -8px; bottom: -8px;
    left: -8px; right: -8px;
    background: linear-gradient(45deg, red, blue);
    content: '';
    z-index: -1;
    border-radius: 50px;
}

#siteBorderDiv.buildsFullscreen{
    width: 100%;
    min-height: 100vh;
    margin: 0;
    padding: 16px;
    border-radius: 0;
    overflow: hidden;
    background: linear-gradient(45deg, rgb(45, 129, 255), rgb(229, 99, 255));
    background-clip: border-box;
}

#siteBorderDiv.buildsFullscreen:after{
    display: none;
}

body.buildsFullscreen{
    margin: 0;
    overflow: hidden;
}

#siteBorderDiv.buildsFullscreen > #charactersDiv,
#siteBorderDiv.buildsFullscreen > #vehiclesDiv,
#siteBorderDiv.buildsFullscreen > #tiresDiv,
#siteBorderDiv.buildsFullscreen > #glidersDiv{
    display: none;
}

#siteBorderDiv.buildsFullscreen #buildDiv{
    min-height: 0;
    width: 100%;
}

#siteBorderDiv.buildsFullscreen #logo,
#siteBorderDiv.buildsFullscreen #buildDiv > h2,
#siteBorderDiv.buildsFullscreen #numberOfPlayersButtonsDiv,
#siteBorderDiv.buildsFullscreen #randomizeAllBtn{
    display: none;
}

#siteBorderDiv.buildsFullscreen #randmozieAllButtonDiv{
    min-height: 0;
    margin: 0 0 10px;
}

#siteBorderDiv.buildsFullscreen #randomizeAllBtn{
    display: inline-block;
}

#siteBorderDiv.buildsFullscreen #buildsTablesDiv{
    gap: 12px;
}

#siteBorderDiv.buildsFullscreen .randomParts,
#siteBorderDiv.buildsFullscreen .errorRandomParts{
    height: clamp(120px, 15vh, 170px);
}

#siteBorderDiv.buildsFullscreen .randomParts > img,
#siteBorderDiv.buildsFullscreen .errorRandomParts > img{
    height: clamp(88px, 12vh, 135px);
}

#siteBorderDiv.buildsFullscreen .randomParts > img.charactersIcon,
#siteBorderDiv.buildsFullscreen .errorRandomParts > img.charactersIcon{
    height: clamp(98px, 13vh, 145px);
}

#siteBorderDiv.buildsFullscreen #buildsTablesDiv{
    overflow: visible;
}

#logo{
    width: 30%;
    border: 0;
    display: block;
    margin: 0 auto;
}

body{
    background-color: #accbfc;
    margin: 8px;
}

html,
body{
    overflow-x: hidden;
}

table{
    border-spacing: 15px;
}

h2{
    font-size: 50px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: white;
    text-shadow: 0 3px 9px black;
    margin-top: 5px;
}

h3{
    font-size: 30px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: white;
    text-shadow: 0 3px 9px black;
}

.charactersIcon{
    width: 50%;
}

.vehiclePart{
    width: 90%;
}

.tireIcon{
    width: 90%;
}

.gliderIcon{
    width: 90%;
}

.randomParts > img,
.errorRandomParts > img{
    display: block;
    width: 90%;
    height: 78px;
    margin: 0 auto;
    object-fit: contain;
}

.randomParts > img.charactersIcon,
.errorRandomParts > img.charactersIcon{
    width: 100%;
    height: 88px;
}

.randomParts{
    text-align: center;
    font-weight: bold;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    border: 2px solid blue;
    border-radius: 10px;
    background-color: #accbfc;
    width: 150px;
    height: 115px;
    box-shadow: 0 3px 5px black, inset 0 0 5px white;
    box-sizing: border-box;
}

.errorRandomParts{
    text-align: center;
    font-weight: bold;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    border: 2px solid red;
    border-radius: 10px;
    background-color: #fcacac;
    width: 150px;
    height: 115px;
    box-shadow: 0 3px 5px black, inset 0 0 5px white;
    box-sizing: border-box;
}

.selectableCell{
    text-align: center;
    font-weight: bold;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    border: 2px solid blue;
    border-radius: 10px;
    background-color: #accbfc;
    width: 150px;
    height: 115px;
    transition-duration: 0.4s;
    box-shadow: 0 3px 5px black, inset 0 0 5px white;
    box-sizing: border-box;
}

.selectableCell:hover{
    background-color: white;
}

.unselectableCell{
    text-align: center;
    font-weight: bold;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    border: 2px solid red;
    border-radius: 10px;
    background-color: #fcacac;
    width: 150px;
    height: 115px;
    transition-duration: 0.4s;
    box-shadow: 0 3px 5px black, inset 0 0 5px white;
    box-sizing: border-box;
}

.unselectableCell:hover{
    background-color: white;
}

.button{
    width: 100px;
    height: 65px;
    transition-duration: 0.4s;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 5px;
    color:black;
    border-radius: 10px;
    vertical-align: top;
    box-shadow: 0 3px 5px black;
}

.blueButton{
    background: linear-gradient(0deg,#accbfc, transparent)#498fff;
    font-weight: bold;
    border: 2px solid blue;
}

.blueButton:hover{
    background-color: #accbfc;
    color:black;
}

.redButton{
    background: linear-gradient(0deg,#fcacac, transparent)#ff4d4d;
    font-weight: bold;
    border: 2px solid red;
}

.redButton:hover{
    background-color: #fcacac;
    color:black;
}

.greenButton{
    background: linear-gradient(0deg,#ACFCC2, transparent)#00d63d;
    font-weight: bold;
    border: 2px solid green;
}

.greenButton:hover{
    background-color: #ACFCC2;
    color:black;
}

.yellowButton{
    background: linear-gradient(0deg,#Fbffd1, transparent)#eaff00;
    font-weight: bold;
    border: 2px solid rgb(255, 255, 0);
}

.yellowButton:hover{
    background-color: #Fbffd1;
    color:black;
}

.pinkButton{
    background: linear-gradient(0deg,#ffc2f5, transparent)rgb(255, 112, 250);
    font-weight: bold;
    border: 2px solid rgb(218, 55, 212);
}

.pinkButton:hover{
    background-color: #ffc2f5;
    color:black;
}

.orangeButton{
    background: linear-gradient(0deg,#FCD6AC, transparent)#ff9317;
    font-weight: bold;
    border: 2px solid orangered;
}

.orangeButton:hover{
    background-color: #FCD6AC;
    color:black;
}

.cellSizeButton{
    width: 150px;
    height: 50px;
    transition-duration: 0.4s;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 5px;
    color:black;
    border-radius: 10px;
    vertical-align: top;
    box-shadow: 0 3px 5px black, inset 0 0 5px white;
}

.buttonsDiv{
    width: fit-content;
    height: fit-content;
    margin: auto;
}

.buildPlayerPanel{
    min-width: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: hidden;
}

.buildPlayerPanel.displayNone{
    display: none !important;
}

.buildTable{
    width: 100%;
    margin: 0;
}

.tableWithButtons{
    width: fit-content;
    height: fit-content;
}

.tableSection{
    width: fit-content;
    height: fit-content;
    text-align: center;
    margin: auto;
}

.partSection{
    position: relative;
    border: 8px solid transparent;
    border-radius: 50px;
    background: transparent;
    background-clip: padding-box;
    padding: 10px;
    /* just to show box-shadow still works fine */
    box-shadow: 0 3px 9px black;
    margin-top: 10px;
    width: 90%;
}

.footer{
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: black;
    text-align: justify;
    margin: auto;
    margin-top: 10px;
}

.footer a{
    margin-right: 10px;
    color:black;
    text-decoration: none;
}

.footer a:hover{
    color: white;
}

@media (min-width: 0px){
    #siteBorderDiv{
        width: 100%;
        border-width: 5px;
        border-radius: 24px;
        padding-top: 8px;
        padding-bottom: 8px;
    }

    #siteBorderDiv:after{
        top: -5px;
        bottom: -5px;
        left: -5px;
        right: -5px;
        border-radius: 24px;
    }

    #logo{
        width: min(70%, 320px);
    }

    h2{
        font-size: clamp(30px, 6vw, 50px);
    }

    h3{
        font-size: clamp(24px, 4vw, 30px);
    }

    table{
        border-spacing: 6px;
    }

    #buildDiv{
        min-height: calc(100vh - 32px);
        display: flex;
        flex-direction: column;
    }

    #numberOfPlayersButtonsDiv{
        flex-wrap: nowrap;
    }

    #numberOfPlayersButtonsDiv .cellSizeButton{
        flex: 1 1 0;
        min-width: 0;
        width: auto;
        height: 36px;
        margin: 2px;
        padding: 0 2px;
        font-size: 10px;
    }

    #buildsTablesDiv{
        flex: 1;
        grid-template-columns: repeat(var(--player-columns, 1), minmax(0, 1fr));
        align-content: stretch;
        align-items: stretch;
        gap: 24px;
        overflow: hidden;
    }

    .buildPlayerPanel{
        display: flex;
        align-items: stretch;
        justify-content: center;
        width: 100%;
        min-height: 0;
        container-type: inline-size;
        border: 1px solid rgba(0, 0, 255, 0.45);
        border-radius: 8px;
    }

    .buildTable{
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        align-content: start;
        width: 100%;
        border-spacing: 0;
        table-layout: fixed;
    }

    .buildTable tbody{
        display: contents;
    }

    .buildTable tr:first-child,
    .buildTable tr:last-child{
        display: contents;
    }

    .buildTable tr:first-child td{
        width: auto;
        min-width: 0;
        height: auto;
        margin: 3px;
    }

    .buildTable tr:last-child td{
        width: auto;
        min-width: 0;
        padding: 3px;
    }

    .buildTable tr:last-child td:nth-child(1){
        grid-column: 1;
    }

    .buildTable tr:last-child td:nth-child(2){
        grid-column: 2;
    }

    .buildTable tr:last-child td:nth-child(3){
        grid-column: 3;
    }

    .buildTable tr:last-child td:nth-child(4){
        grid-column: 4;
    }

    .buildTable .button,
    .buildTable .cellSizeButton{
        width: 100%;
        box-sizing: border-box;
        margin: 0;
    }

    .buildTable tr:last-child .button{
        height: 34px;
    }

    .buildTable .cellSizeButton{
        width: 100%;
        height: 32px;
        margin: 0;
        padding: 1px;
        font-size: clamp(7px, 2.5cqi, 10px);
        line-height: 1.1;
        overflow-wrap: anywhere;
    }

    .buildTable .button{
        font-size: clamp(7px, 2.5cqi, 10px);
        line-height: 1.1;
        overflow-wrap: anywhere;
    }

    .buildTable tr:last-child .button{
        height: auto;
        min-height: 34px;
    }

    .buildTable .randomParts,
    .buildTable .errorRandomParts{
        font-size: clamp(7px, 2.5cqi, 16px);
        line-height: 1.1;
        overflow-wrap: anywhere;
    }

    .randomParts,
    .errorRandomParts,
    .selectableCell,
    .unselectableCell{
        width: 120px;
        height: 105px;
    }

    .randomParts > img,
    .errorRandomParts > img{
        height: 68px;
    }

    .randomParts > img.charactersIcon,
    .errorRandomParts > img.charactersIcon{
        height: 76px;
    }

    .button{
        width: 105px;
        height: 58px;
        margin: 3px;
        font-size: 12px;
    }

    .cellSizeButton{
        width: 125px;
        height: 48px;
        margin: 4px;
    }

    .partSection{
        width: 100%;
        box-sizing: border-box;
        border-width: 5px;
        border-radius: 24px;
        padding: 6px;
    }
}

@media (max-width: 500px){
    body{
        margin: 4px;
    }

    .buildPlayerPanel{
        height: auto;
    }

    .randomParts,
    .errorRandomParts,
    .selectableCell,
    .unselectableCell{
        width: 105px;
        height: 96px;
    }

    .randomParts > img,
    .errorRandomParts > img{
        height: 58px;
    }

    .randomParts > img.charactersIcon,
    .errorRandomParts > img.charactersIcon{
        height: 66px;
    }

    .button{
        width: 92px;
        font-size: 11px;
    }

    .cellSizeButton{
        width: 112px;
    }
}

    @media (max-width: 1024px){ 
        #buildsTablesDiv{ 
            grid-template-columns: 1fr !important; 
        } 
    }

    @media (min-width: 700px) and (max-width: 1024px){
        #buildsTablesDiv{
            grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
            gap: 10px;
        }

        #buildsTablesDiv.singleColumnBuildLayout{
            grid-template-columns: 1fr !important;
        }
    }

    @media (max-width: 1200px){
        #buildDiv{
            min-height: auto;
        }

        #buildsTablesDiv{
            flex: 0 0 auto;
            align-content: start;
            align-items: start;
            overflow: visible;
        }

        .buildPlayerPanel{
            height: auto;
        }
    }

    @media (max-width: 1024px) and (orientation: portrait){
        #buildDiv{
            min-height: auto;
        }

        #buildsTablesDiv{
            grid-template-columns: repeat(var(--player-columns, 1), minmax(0, 1fr)) !important;
            align-content: start;
            align-items: start;
        }

        .buildPlayerPanel{
            height: auto;
        }

    }

    @media (min-width: 1025px){ 
        #buildsTablesDiv{ 
            grid-template-columns: repeat(var(--player-columns, 1), minmax(0, 1fr)); 
        } 

        #kartsTable{
            display: grid;
            grid-template-columns: repeat(8, 120px);
            gap: 6px;
        }

        #charactersTable,
        #standartBikesTable,
        #sportBikesTable,
        #atvsTable,
        #tiresTable,
        #glidersTable{
            display: grid;
            grid-template-columns: repeat(8, 120px);
            gap: 6px;
        }

        #kartsTable,
        #charactersTable,
        #standartBikesTable,
        #sportBikesTable,
        #atvsTable,
        #tiresTable,
        #glidersTable{
            width: max-content;
            margin-left: auto;
            margin-right: auto;
        }

        #kartsTable td,
        #charactersTable td,
        #standartBikesTable td,
        #sportBikesTable td,
        #atvsTable td,
        #tiresTable td,
        #glidersTable td{
            justify-self: center;
        }

        #charactersAndBtnDiv,
        #kartsAndBtnDiv,
        #standartBikesAndBtnDiv,
        #sportBikesAndBtnDiv,
        #atvsAndBtnDiv,
        #tiresAndBtnDiv,
        #glidersAndBtnDiv{
            overflow-y: hidden;
        }

        #kartsTable tbody,
        #kartsTable tr,
        #charactersTable tbody,
        #charactersTable tr,
        #standartBikesTable tbody,
        #standartBikesTable tr,
        #sportBikesTable tbody,
        #sportBikesTable tr,
        #atvsTable tbody,
        #atvsTable tr,
        #tiresTable tbody,
        #tiresTable tr,
        #glidersTable tbody,
        #glidersTable tr{
            display: contents;
        }

        #kartsTable tr:last-child td:first-child,
        #standartBikesTable tr:last-child td:first-child,
        #sportBikesTable tr:last-child td:first-child,
        #atvsTable tr:last-child td:first-child,
        #tiresTable tr:last-child td:first-child,
        #glidersTable tr:last-child td:first-child{
            grid-column-start: 2;
        }

        #charactersTable tr:last-child td:first-child{
            grid-column-start: 4;
        }

        #standartBikesTable tr:last-child td{
            position: relative;
            left: -56px;
        }

        #glidersTable tr:last-child td{
            position: relative;
            left: -63px;
        }

        #sportBikesTable tr:last-child td,
        #tiresTable tr:last-child td{
            position: relative;
            left: 63px;
        }
    }