html{
    background-color: black;
    color: white;
    width: 100%;
    height: 100%;
    margin: 0px;
}
body{
    overflow: hidden;
    width: 100%;
    height: 100%;
    margin: 0px;
}
body > canvas{
    margin: 0px;
}
button{
    cursor: pointer;
}

#gameArea{
    transition: all 0.25s;
    opacity: 1;
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: url("background.png");
    image-rendering: pixelated;
}

#sections{
    padding: 20px;
    width: calc(100% - 40px);
    height: calc(100% - 40px);
}
#sections > div{
    background-color: transparent;
}
#sections > :nth-child(1){
    border-top: solid 1px gray;
    border-bottom: dotted 1px lightgray;
    border-left: solid 1px gray;
    border-right: dotted 1px lightgray;
}
#sections > :nth-child(2){
    border-top: solid 1px gray;
    border-bottom: dotted 1px lightgray;
    border-right: solid 1px gray;

    display: flex;
    justify-content: space-between;
    > :nth-child(1){
        flex-grow: 1;
    }
}
#sections > :nth-child(3){
    border-left: solid 1px gray;
    border-right: dotted 1px lightgray;
    border-bottom: solid 1px gray;
}
#sections > :nth-child(4){
    border-right: solid 1px gray;
    border-bottom: solid 1px gray;
}
@supports not (grid-column: 1){
    #sections{
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        align-content: flex-start;
    }
    #sections > :nth-child(1){
        width: 16%;
        height: 17%;
    }
    #sections > :nth-child(2){
        width: 83%;
        height: 17%;
    }
    #sections > :nth-child(3){
        width: calc(16% - 12px);
        height: 82%;
    }
    #sections > :nth-child(4){
        width: 83%; 
    }
}
@supports(grid-column: 1){
    #sections{
        display: grid;
        grid-template-columns: 16% 1fr;
        grid-template-rows: auto 1fr;
    }
    #sections > :nth-child(1){
        grid-column: 1;
        grid-row: 1;
    }
    #sections > :nth-child(2){
        grid-column: 2;
        grid-row: 1;
        max-height: 144px;
    }
    #sections > :nth-child(3){
        grid-column: 1;
        grid-row: 2;
    }
    #sections > :nth-child(4){
        grid-column: 2;
        grid-row: 2;
    }
}

#upgradeArea{
    transition: all 0.25s;
    opacity: 0;
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: url("background.png");
    image-rendering: pixelated;
    > div{
        display: flex;
        align-content: center;
        flex-wrap: wrap;
        flex-direction: column;

        padding: 20px;
        width: calc(100% - 40px);

        > div:nth-child(1){
            height: 144px;
            width: 70%;
            border: solid 1px gray;
            border-bottom: dotted 1px lightgray;
        }
        > div:nth-child(2){
            display: grid;
            align-content: flex-start;
            gap: 20px;
            border-left: solid 1px gray;
            border-right: solid 1px gray;
            padding: 20px;
            justify-items: stretch;
            justify-content: start;
            grid-template-columns: repeat(3, 1fr);
            .upgradePanel{
                display: flex;
                flex-direction: column;
                align-items: center;
                font-family: Verdana, Arial, Helvetica, sans-serif;
                font-size: 14px;
                color: lightgray;
                font-weight: bold;
                > div{
                    display: flex;
                    flex-direction: row;
                    align-items: center;
                    border: 1px solid rgb(56, 56, 56);
                    border-radius: 5px;
                    padding: 5px;
                    margin: 5px;
                    width: calc(100% - (5px * 2));
                    align-items: flex-end;
                    > div:nth-child(1){
                        margin-right: 5px;
                    }
                    .upgradeText{
                        margin-right: auto;
                        height: 100%;
                        display: flex;
                        flex-direction: row;
                        align-items: center;
                    }
                    .upgradeIcon{
                        width: 29px;
                        height: 29px;
                        border: 1px solid gray;
                        border-radius: 2px;
                        > div {
                            position: absolute;
                            display: flex;
                            align-items: flex-end;
                            justify-content: flex-end;
                            font-size: 10px;
                            width: 23px;
                            height: 25px;
                            transform: translate(2px, 2px);
                            padding-right: 2px;
                        }
                    }
                    .upgradeIcon::before{
                        position: absolute;
                        content: "";
                        display: block;
                        width: 25px;
                        height: 25px;
                        transform: translate(2px, 2px);
                        background: url(gameTiles.png);
                    }
                    .upgradeIcon:nth-child(1)::before{
                        background-position: var(--posX) var(--posY);
                    }
                    .blockUpgradeIcon{
                        background-color: #FF00007F;
                        border: 1px solid red;
                        > div{
                            background-color: #FF00007F;
                        }
                    }
                    .blockUpgradeIconMin::before{
                        opacity: 0.3;
                    }

                    .maxUpgradeIcon{
                        background-color: #90ee907f;
                        border: 1px solid lightgreen;
                        > div{
                            background-color: #90ee907f;
                        }
                    }

                    .upgradeIconMin{
                        margin-left: 5px;
                        width: 24px;
                        height: 24px;
                        margin-right: 2px;
                        border-radius: 3px;
                        > div {
                            width: 20px;
                            height: 20px;
                        }
                    }
                    .upgradeIconMin::before{
                        width: 20px;
                        height: 20px;
                    }

                    .generateIcon{ cursor: pointer; }
                    .generateIconMin{ cursor: pointer; }
                    .generateIcon::before{ background-position: -442px -670px; }
                    .generateIconMin::before{ background-position: -468px -670px; }

                    .makeIcon{ cursor: pointer; }
                    .makeIconMin{ cursor: pointer; }
                    .makeIcon::before{ background-position: -489px -670px; }
                    .makeIconMin::before{ background-position: -515px -670px; }

                    .sellIcon{ cursor: pointer; }
                    .sellIconMin{ cursor: pointer; }
                    .sellIcon::before{ background-position: -536px -670px; }
                    .sellIconMin::before{ background-position: -562px -670px; }

                    .costIcon{ cursor: pointer; }
                    .costIconMin{ cursor: pointer; }
                    .costIcon::before{ background-position: -583px -670px; }
                    .costIconMin::before{ background-position: -609px -670px; }

                    .yieldIcon{ cursor: pointer; }
                    .yieldIconMin{ cursor: pointer; }
                    .yieldIcon::before{ background-position: -630px -670px; }
                    .yieldIconMin::before{ background-position: -656px -670px; }

                }
            }
        }
    }
}

.smallText{
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 12px;
}
.normalText{
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 14px;
}
.subText{
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 14px;
    color: lightgray;
}
.moneyText{
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 14px;
    color: yellow;
}
.grayText{
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 10px;
    color: lightgray;
}
.researchText{
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 14px;
    color: rgb(103,200,224);
}
.boldText{
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 14px;
    font-weight: bolder;
}
.efficiencyText{
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 14px;
    color: lightblue;
}
.greenText{
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 14px;
    color: lightgreen;
}
.redText{
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 14px;
    color: red;
}

.topButtonGroup{
    display: flex;
    height: 30px;
}
.topButton{
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 12px;
    padding: 5px;
    padding-top: 8px;
    margin: 2px;
    margin-top: 0px;
    border-radius: 0px 0px 6px 6px;
    border: solid 1px lightslategray;
    border-top: none;
}
.topButton:hover{
    cursor: pointer;
    background-color: lightslategray;
}

.tileSelect{
    display: flex;  
    color: transparent;
    
}
.tileSelect > input{
    display: none;
}
.tileSelect > label{
    width: 25px;
    height: 25px;
    margin: 2px;
    background: url(gameTiles.png);
    image-rendering: pixelated;
    cursor: pointer;
}
.tileSelect > label::after{
    content: "";
    display: block;
    width: 29px;
    height: 29px;
    transform: translate(-2px, -2px);
    background: url(gameTiles.png);
    background-position: -382px -670px;
}
.tileSelect > label:hover:after{
    background-position: -412px -670px;
    z-index: 0;
    position: absolute;
}
.tileSelect > input[type="radio"]:checked + label:after {
    background-position: -352px -670px;
    z-index: 0;
    position: absolute;
}

#components{
    padding: 4px;
}

#sideButtons{
    display: grid;
    justify-content: stretch;
    align-content: start;
    justify-items: start;
    margin: 10px;
    
    > div{
        display: flex;
        flex-direction: row;
        justify-content: flex-start;
        width: 100%;
    }
    > div > div{
        border: solid white 1px;
        border-radius: 6px;
        margin: 2px;
        padding: 3px;
        padding-left: 6px;
        padding-right: 6px;
        height: 16px;
    
        font-family: Verdana, Arial, Helvetica, sans-serif;
        font-size: 12px;
        
        background-color: transparent;
    }
    > div > div:hover{
        background-color: #282828;
        cursor: pointer;
    }
}

#blocker{
    position: absolute;
    width: 100%;
    height: 100%;
    >:nth-child(1){
        position: absolute;
        background-color: black;
        opacity: 0;
        width: 100%;
        height: 100%;
        z-index: 1;
        transition: all, 0.25s;
    }
    >:nth-child(2){
        transition: all, 0.25s;
        opacity: 0;
        position: absolute;
        z-index: 1;
        color: white;
        background-color: black;
        width: 25%;
        min-height: 20%;
        left: calc(50% - (25%/2));
        top: calc(40% - (20%/2));

        border-radius: 5px;
        padding: 15px;
        color: white;
        border: 1px solid gray;

        display: flex;
        gap: 8px;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        :nth-child(3){
            display: flex;
            justify-content: space-between;
            margin-top: auto;
            > div{
                border: solid white 1px;
                border-radius: 6px;
                margin: 2px;
                padding: 3px;
                padding-left: 12px;
                padding-right: 12px;
                height: 16px;
            
                font-family: Verdana, Arial, Helvetica, sans-serif;
                font-size: 12px;
                
                background-color: transparent;
            }
            > div:hover{
                background-color: #282828;
                cursor: pointer;
            }
        }
    }
}
#details{
    display: flex;
    flex-direction: row;
    justify-content: space-between;

    letter-spacing: -1px;
    line-height: 16px;

}

#detailDiagram{
    height: 400px;
    z-index: 2;
    pointer-events: none;
}

._detailDiagramPanel{
    display: flex;
    flex-direction: column; 
    align-items: center;

    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 10px;
    font-weight: bold;
    
    width: 100px;
    height: 100px;

    line-height: 10px;
    margin-right: 10px;
    gap: 4px; /* 8px / 2 because of middle line of lines */
    > div{
        position: absolute;
        transform: translate(0px, var(--pos));
    }
    > div:nth-child(1), > div:nth-child(3) {
        z-index: 1;
        display: flex;
        gap: 15px;
        > div{
            display: flex;
            width: 25px;
            height: 25px;
            align-items: center;
            justify-content: flex-start;
            flex-direction: row;
            background: url(gameTiles.png);
            background-position: -352px -462px;
            > p {
                transform: translate(26px, -1px);
            }
        }
    }
    > div:nth-child(2){
        display: flex;
        gap: 15px;
        > div{
            --deg: 0deg;
            --length: 0px;
            position: absolute;
            transform-origin: bottom;
            align-self: end;
            background-color: #6C6C6C;
            width: 3px;
            height: var(--length);
            transform: translate(-1px, calc((-25px / 2) - 3px)) rotate(calc(180deg + var(--deg)))
        }
    }
}
#mapPanel{
    position: relative;
    > *{ 
        position: absolute;
        > *{
            position: absolute;
            > *{
                position: absolute;
            }
        }
        > .mapBlocker{
            > div{
                background-color: #00000066;
                text-align: center;
                align-content: center;
                font-size: 16px;
                cursor: pointer;
                -webkit-touch-callout: none; /* iOS Safari */
                -webkit-user-select: none;   /* Safari */
                -khtml-user-select: none;    /* Konqueror HTML */
                -moz-user-select: none;      /* Firefox */
                -ms-user-select: none;       /* Internet Explorer/Edge */
                user-select: none;           /* Non-prefixed version */
            }
        }
        > .mapBlocker:has(> div:hover){
            > div{
                background-color: #454545CC;
            }
        }
    }
}