/* global styles */

* {
    box-sizing: border-box;
}

:root {
    --font-color: #ddd;
    --background-color: rgb(10, 8, 30);
    --tile-bottom-right-color: #eec;
    --tile-top-left-color: #eef;
    --tile-hover-color: #ee7;
    --tile-alert-color: #ff0;
    --tile-border-color: #555;
    --tile-back-color: #888;
    --link-color: orange;
    --button-color: rgb(80, 29, 161);
    --button-hover-color: rgb(113, 29, 161);
    --base-width: 1000px;
    --base-height: 700px;
}

body {
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    font-weight: 300;
    font-size: 18px;
    background-color: var(--background-color);
    color: var(--font-color);
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
}

strong {
    font-weight: 600;
}

/* wrapper */

#wrapper {
    transform-origin: top center;
    width: 100%;
    max-width: 100vw;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* header - HIDDEN */

header {
    display: none;
}

/* main */

main {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
}

/* footer */

footer {
    padding-top: 15px;
    position: relative;
    width: 100%;
    max-width: 100vw;
}

/* Game info display */
#gameInfo {
    position: absolute;
    left: 0;
    top: 0;
    display: flex;
    gap: 20px;
    font-size: 16px;
    font-weight: 600;
}

#timer {
    color: var(--tile-hover-color);
}

#tileCount {
    color: var(--tile-alert-color);
}

#statusText {
    float: left;
}

#controls {
    float: right;
}

/* buttons */

button {
    border: none;
    outline: none;
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
    color: var(--font-color);
    background-color: var(--button-color);
    padding: 5px 15px;
    margin-left: 10px;
    transition: background-color 100ms linear;
}

button:hover {
    cursor: pointer;
    background-color: var(--button-hover-color);
}

/* game */

#game {
    height: var(--base-height);
    background: url("./img/background-small.jpg") no-repeat center center;
    background-size: 100% 100%;
    position: relative;
    border-radius: 5px;
    opacity: 0;
    width: 100%;
    max-width: var(--base-width);
    margin: 0 auto;
}

/* Center the tile container on mobile - compensate for TOTAL_OFFSET_LEFT */
@media (max-width: 875px) {
    #game {
        transform: translateX(-150px);
    }
}

@media (max-width: 620px) {
    #game {
        transform: translateX(-180px);
    }
}

@media (max-width: 520px) {
    #game {
        transform: translateX(-200px);
    }
}

@media (max-width: 480px) {
    #game {
        transform: translateX(-215px);
    }
}

@media (max-width: 435px) {
    #game {
        transform: translateX(-230px);
    }
}

@media (max-width: 390px) {
    #game {
        transform: translateX(-245px);
    }
}

/* tile */

.tile {
    position: absolute;
}

.tileFront {
    position: absolute;
    background-image: linear-gradient(
        to left top,
        var(--tile-bottom-right-color),
        var(--tile-top-left-color)
    );
    border: 1px solid var(--tile-border-color);
}

.playableTile:hover {
    cursor: pointer;
    background-image: linear-gradient(
        to left top,
        var(--tile-hover-color),
        var(--tile-hover-color)
    );
}

.selectedTile {
    background-image: linear-gradient(
        to left top,
        var(--tile-hover-color),
        var(--tile-hover-color)
    );
}

.alertTile {
    background-image: linear-gradient(
        to left top,
        var(--tile-alert-color),
        var(--tile-alert-color)
    );
}

.tileBack {
    position: absolute;
    background-color: var(--tile-back-color);
    border: 1px solid var(--tile-border-color);
}

/* media queries - Responsive scaling */

@media (min-width: 876px) and (max-width: 1010px) {
    .tile {
        transform: translateX(-65px);
    }
    :root {
        --base-width: 865px;
    }
}

@media (max-width: 875px) {
    #wrapper {
        transform: scale(0.95);
    }
    footer {
        padding: 20px 0px;
    }
    .tile {
        transform: translateX(0) !important;
    }
}

@media (max-width: 830px) {
    #wrapper {
        transform: scale(0.9);
    }
}

@media (max-width: 780px) {
    #wrapper {
        transform: scale(0.85);
    }
}

@media (max-width: 745px) {
    #wrapper {
        transform: scale(0.8);
    }
}

@media (max-width: 700px) {
    #wrapper {
        transform: scale(0.75);
    }
}

@media (max-width: 660px) {
    #wrapper {
        transform: scale(0.7);
    }
}

@media (max-width: 620px) {
    #wrapper {
        transform: scale(0.65);
    }
}

@media (max-width: 570px) {
    #wrapper {
        transform: scale(0.6);
    }
}

@media (max-width: 520px) {
    #wrapper {
        transform: scale(0.55);
    }
}

@media (max-width: 480px) {
    #wrapper {
        transform: scale(0.5);
    }
}

@media (max-width: 435px) {
    #wrapper {
        transform: scale(0.45);
    }
}

@media (max-width: 390px) {
    #wrapper {
        transform: scale(0.4);
    }
}

@media (max-width: 350px) {
    #wrapper {
        transform: scale(0.38);
    }
}
