:root {
    --red: #fd2e3f;
    --yellow: #fee222;
    --blue: #0969c6;
}
body {
    max-width: 100vw;
    max-height: 100vh;
    overflow: hidden;
    margin: 0;
    font-family: sans-serif;
}
body, div {
    box-sizing: border-box;
}
button {
    background-color: var(--red);
    border: 2px solid black;
    color: var(--yellow);
    box-shadow: 0px 5px 0px 0px var(--yellow);
    border-radius: 0.5rem;
    cursor: pointer;
}
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 99;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    font-size: 36px;
    font-family: sans-serif;
    background-color: var(--blue);
    flex-direction: column;
    gap: 1rem;
}
#preloader .ball {
    width: 75px;
    height: 75px;
    background-color: var(--red);
    border-radius: 50%;
    border: 3px solid black;
    box-shadow: 0px 4px 0px 0px var(--yellow);
    animation: preloader 1s ease infinite;
}
#preloader.loaded {
    display: none;
}
@keyframes preloader {
    0% {
        transform: translateY(0px) rotate(0deg);
    }
    50% {
        transform: translateY(-50px) rotate(180deg);
    }
    100% {
        transform: translateY(0px) rotate(360deg);
    }
}
.preloadImage {
    display: none;
}
#roomPrompt {
    width: 100%;
    height: 100vh;
    justify-content: center;
    align-items: center;
    background: var(--blue);
}
#roomPrompt input, #roomPrompt button {
    line-height: 36px;
}
#roomPrompt input {
    min-width: 200px;
    border-radius: 0.5rem;
    border: 2px solid black;
    padding: .5rem;
    margin-right: 0.25rem;
    box-shadow: 0px 5px 0px 0px var(--yellow);
}
#roomPrompt button {
    padding: .5rem 1rem;
}
#roomContainer {
    flex-direction: column;
    height: 100vh;
    width: 100%;
    padding: 1rem;
}
#roomContainer.waiting {
    background: var(--blue);
    justify-content: center;
    align-items: center;
    text-align: center;
}
#invitationLinkButton {
    padding: .5rem 1rem;
}
#infoWindow {
    background-color: var(--yellow);
    border: 1px solid black;
    width: 100%;
    padding: .5rem;
    height: 2.5rem;
    overflow-y: scroll;
    text-align: center;
}

#gameDebug {
    display: none;
}

#tableContainer {
    display: flex;
    min-height: 12rem;
}

#gameContainer {
    max-height: 100vh;
    overflow-y: scroll;
    overflow-x: hidden;
    padding-bottom: 3rem;
}
#submitMoveWrapper {
    position: fixed;
    z-index: 90;
    width: 96vw;
    left: 2vw;
    bottom: .5rem;
    height: 3rem;
    line-height: 3rem;
    background-color: white;
}
#submitMove {

    background-color: var(--red);
    color: var(--yellow);
    text-align: center;
    text-transform: uppercase;
    cursor: pointer;
    font-size: 1rem;
    font-family: sans-serif;
    justify-content: center;
    border-radius: .5rem;
    box-shadow: 0px 5px 0px 0px var(--blue);
    cursor: pointer;
    user-select: none;
    transition: all 0.2 ease;
    width: 100%;
}
#submitMove.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: 0px 5px 0px 0px var(--yellow);
}
#table {
    padding: 1rem;
    background-image: url("https://www.publicdomainpictures.net/pictures/30000/nahled/wood-texture.jpg");
    background-size: auto;
    border: none;
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
#table.selecting .card:not(.selected), #myHand.selecting .card:not(.selected) {

    box-shadow: 0px 5px 0px 0px var(--yellow);
}

#deck {
    background-color: #888;
    width: 135px;
    height: 300px;
    text-align: center;
    line-height: 300px;
    margin: 1.5rem 1rem;
}
#myHand, #opponentsHand {
    display: flex;
    margin: 0.5rem;
    justify-content: center;
    max-width: 100%;
}
.card {
    background-color: #fff;
    margin: .5rem;
    width: 135px;
    height: 280px;
    text-align: center;
    padding: 1rem;
    box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.25);
    transition: all 0.2s ease;
    border-radius: .25rem;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
    z-index: 40;
}
.card.hidden {
    background-color: #888;
}
#opponentsHand .card:not(.animatePlayedCard) {
    height: 50px;
}
#myHand.selecting .card, #myHand.selected .card, #table.selecting .card {
    cursor: pointer;
}
#myHand.selecting .card:hover:not(.selected ), #myHand.selected .card:hover:not(.selected) {
    margin-top: -1rem;
}
#myHand .card.selected {
    margin-top: 0 !important;
    box-shadow: 0px 5px 0px 0px var(--red);
    border: 2px solid red;
}
#table .card.selected {
    box-shadow: 0px 5px 0px 0px black;
    border: 2px solid black;
    transform: scale(1.05);
}
#gameOver {
    display: none;
    flex-direction: column;
    text-align: center;
}
#gameOver .title {
    margin-bottom: 0;
}

#scoreDetails table {
    margin: 1rem auto;
    border-collapse: collapse;
}
#scoreDetails table th, #scoreDetails table td {
    padding: 0.5rem;
    border: 2px solid black;
    width: 50px;
}
#scoreDetails table th:first-child, #scoreDetails table td:first-child {
    width: 150px;
}

/* animations */
#opponentsHand {
    position: relative;
}
#opponentsHand .animatePlayedCard {
    position: fixed;
    left: 0;
    animation: animatePlayedCard .3s ease forwards;
    z-index: 60;
}
#table {
    position: relative;
}
.animateCapturedCard {
    z-index: 50;
}
@keyframes animatePlayedCard {
    from {
        transform: translateY(0);
    }
    to {
        transform: translateY(3rem);
    }
}
@keyframes animateAfterCapture {
    from {
        margin-top: 0;
        opacity: 1
    }
    to {
        margin-top: -350px;
        opacity: 0
    }
}

/* flashes*/
.specialMoveFlash {
    width: 100vw;
    height: 30vh;
    position: fixed;
    top:35vh;
    left: 0;
    z-index: 90;
    text-align: center;
    font-size: 48px;
    font-family: monospace;
    text-transform: uppercase;
    animation: specialMoveFlash 0.2s infinite;
    color: white;
    font-weight: bolder;
    text-shadow: 2px 2px black;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0px 5px 0px 0px black;
}
.specialMoveFlash.invalid {
    background-color: var(--blue);
    color: var(--yellow);
    box-shadow: 0px 5px 0px 0px var(--red);
    animation: none;
}
@keyframes specialMoveFlash {
    0% {
        background-color: var(--red);
    }
    33% {
        background-color: var(--yellow);
    }
    67% {
        background-color: var(--blue);
    }
    100% {
        background-color: var(--red);
    }
}

#playAgain {
    height: 2rem;
    margin: 0 auto;
    padding: 0.25rem 1rem;
}
#playAgainWaiting {
    text-align: center;
}

@media screen and (max-width: 768px){

    #roomContainer {
        padding: 0;
    }
    #roomContainer p {
        margin: 0;
        padding: .5rem;
    }
    #infoWindow {
        display: flex;
        justify-content: center;
        align-items: center;
        height: 2.5rem;
        padding: .25rem;
        font-size: .75rem;
    }
    #table {
        margin: 0 -1rem;
        width: 100%;
        padding: 0.5rem;
        flex-wrap: wrap;
    }
    #opponentsHand, #myHand {
        margin: 0;
    }
    #myHand {
        justify-content: flex-start;
        overflow-x: scroll;
        background: none;
    }
    #deck {
        display: none;
    }
    .card {
        padding: 3px;
        width:75px;
        min-width: 75px;
        height: 140px;
        margin: .25rem;
    }
    #opponentsHand .card:not(.animatePlayedCard) {
        height: 20px;
        line-height: 20px;
        padding: 0;
    }
    #opponentsHand .animatePlayedCard {
        height: 140px;
    }
    .specialMoveFlash.invalid {
        font-size: 24px;
    }
}

@media screen and (max-width: 360px){

    .card {
        min-width: 50px;
        width: 50px;
        height: 105px;
    }
    #opponentsHand .animatePlayedCard {
        height: 105px;
    }

}
