/* Globals */
@font-face {
    font-family: 'Font Awesome 6 Pro';
    font-style: normal;
    font-weight: 900;
    font-display: block;
    src: url("fa-solid-900.woff2") format("woff2"), url("fa-solid-900.ttf") format("truetype");
}

* {
    box-sizing: border-box;
    font-family: 'Rockwell', serif;
    transition: all 1s ease-in-out;
}

.fas,
.fa-solid {
    font-weight: 900;
}

html, body {
    height: 100dvh;
    margin: 0;
    overflow: hidden;
    padding: 0;
    position: relative;
    width: 100vw;
}

/* The Table */
.table {
    /* background-image: linear-gradient(to bottom right, #059669, #064e3b); */
    /* background-color: #064e3b; */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 56 28' width='56' height='28'%3E%3Cpath fill='%23000000' fill-opacity='0.1' d='M56 26v2h-7.75c2.3-1.27 4.94-2 7.75-2zm-26 2a2 2 0 1 0-4 0h-4.09A25.98 25.98 0 0 0 0 16v-2c.67 0 1.34.02 2 .07V14a2 2 0 0 0-2-2v-2a4 4 0 0 1 3.98 3.6 28.09 28.09 0 0 1 2.8-3.86A8 8 0 0 0 0 6V4a9.99 9.99 0 0 1 8.17 4.23c.94-.95 1.96-1.83 3.03-2.63A13.98 13.98 0 0 0 0 0h7.75c2 1.1 3.73 2.63 5.1 4.45 1.12-.72 2.3-1.37 3.53-1.93A20.1 20.1 0 0 0 14.28 0h2.7c.45.56.88 1.14 1.29 1.74 1.3-.48 2.63-.87 4-1.15-.11-.2-.23-.4-.36-.59H26v.07a28.4 28.4 0 0 1 4 0V0h4.09l-.37.59c1.38.28 2.72.67 4.01 1.15.4-.6.84-1.18 1.3-1.74h2.69a20.1 20.1 0 0 0-2.1 2.52c1.23.56 2.41 1.2 3.54 1.93A16.08 16.08 0 0 1 48.25 0H56c-4.58 0-8.65 2.2-11.2 5.6 1.07.8 2.09 1.68 3.03 2.63A9.99 9.99 0 0 1 56 4v2a8 8 0 0 0-6.77 3.74c1.03 1.2 1.97 2.5 2.79 3.86A4 4 0 0 1 56 10v2a2 2 0 0 0-2 2.07 28.4 28.4 0 0 1 2-.07v2c-9.2 0-17.3 4.78-21.91 12H30zM7.75 28H0v-2c2.81 0 5.46.73 7.75 2zM56 20v2c-5.6 0-10.65 2.3-14.28 6h-2.7c4.04-4.89 10.15-8 16.98-8zm-39.03 8h-2.69C10.65 24.3 5.6 22 0 22v-2c6.83 0 12.94 3.11 16.97 8zm15.01-.4a28.09 28.09 0 0 1 2.8-3.86 8 8 0 0 0-13.55 0c1.03 1.2 1.97 2.5 2.79 3.86a4 4 0 0 1 7.96 0zm14.29-11.86c1.3-.48 2.63-.87 4-1.15a25.99 25.99 0 0 0-44.55 0c1.38.28 2.72.67 4.01 1.15a21.98 21.98 0 0 1 36.54 0zm-5.43 2.71c1.13-.72 2.3-1.37 3.54-1.93a19.98 19.98 0 0 0-32.76 0c1.23.56 2.41 1.2 3.54 1.93a15.98 15.98 0 0 1 25.68 0zm-4.67 3.78c.94-.95 1.96-1.83 3.03-2.63a13.98 13.98 0 0 0-22.4 0c1.07.8 2.09 1.68 3.03 2.63a9.99 9.99 0 0 1 16.34 0z'%3E%3C/path%3E%3C/svg%3E");
    height: 100%;
    overflow: hidden;
    position: absolute;
    width: 100%;
}

.table .pile {
    /* background: red; */
    /* height: calc(100vh - 450px); */
    height: calc(100vh - 200px);
    /* left: 225px; */
    left: 40px;
    position: absolute;
    /* top: 225px; */
    top: 40px;
    /* width: calc(100vw - 450px); */
    width: calc(100vw - 80px);
    z-index: 5;
}

.table .pile .card {
    position: absolute;
}

.table .pile .card.player-0 {
    margin-right: 180px;
    margin-top: -87px;
    right: 50%;
    top: 50%;
}

.table .pile .card.player-1 {
    left: 50%;
    margin-left: -62px;
    top: 50px;
}

.table .pile .card.player-2 {
    left: 50%;
    margin-left: 100px;
    margin-top: -87px;
    top: 50%;
}

.table .pile .card.player-3 {
    bottom: 50px;
    left: 50%;
    margin-left: -62px;
    top: auto;
}

/* Players */
.table .player-container {
    align-items: center;
    display: flex;
    justify-content: center;
    height: 140px;
    width: 175px;
    position: absolute;
    z-index: 15;
}

.table .player-container h2 {
    border-radius: 0.5rem;
    top: 0px;
    color: #fff;
    display: flex;
    font-size: 20px;
    font-weight: 900;
    height: 35px;
    line-height: 35px;
    margin: 0;
    opacity: 0.8;
    position: absolute;
    text-shadow: 0px 0px 2px #000000, 1px 1px 0px #000000;
    transform-origin: center center;
    width: max-content;
    z-index: 10;
}

.table .player-container h2 span {
    display: inline-block;
    height: 35px;
    line-height: 35px;
    padding: 3px 10px;
}

.table .player-container h2 .score {
    background: rgba(0, 0, 0, 0.25);
}

.table .player-container h2 .total {
    background: rgba(0, 0, 0, 0.5);
    border-radius: 0 0.5rem 0.5rem 0;
}

.table .player-container.player-1 {
    left: -25px;
    rotate: 90deg;
    top: 50%;
    translate: -50% -50%;
    width: 100%;
}

.table .player-container.player-2 {
    left: 0;
    rotate: 180deg;
    top: -95px;
    width: 100%;
}

.table .player-container.player-1 h2 {
    left: 50%;
    rotate: -90deg;
    transform-origin: left center;
    top: 15px;
}

.table .player-container.player-2 h2 {
    rotate: 180deg;
}

.table .player-container.player-3 {
    right: -25px;
    rotate: 270deg;
    top: 50%;
    translate: 50% -50%;
    width: 100%;
}

.table .player-container.player-3 h2 {
    right: 50%;
    rotate: 90deg;
    transform-origin: right center;
    top: 15px;
}

.table .player-container.player-4 {
    left: 0;
    bottom: 10px;
    width: 100%;
}

.table .player-container.player-4 h2 {
    bottom: 10px;
    top: auto;
}

.table .player-container .card {
    left: -50px;
    transition-property: all;
    transition-duration: 0.3s;
    transition-timing-function: ease-in-out;
    top: 0px;

    --card-fan-rotation: 3.3deg;
    --card-fan-spread: -6vmin;
    --option-index: calc(sibling-index() - 1);
    --center: calc(sibling-count() / 2);
    --offset-from-center: calc(var(--option-index) - var(--center));

    rotate: calc(var(--offset-from-center) * var(--card-fan-rotation));
    translate: calc(var(--offset-from-center) * var(--card-fan-spread)) 0;
    transform-origin: center 1000px;
}

.table .player-container.player-4 .card:not(.disabled):hover,
.table .player-container.player-4 .card.selected {
    top: -20px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    cursor: pointer;
}
.table .player-container.player-4 .card.received {
    top: -20px;
    animation: receiving 4s linear forwards;
}

@keyframes receiving {
    0% {
        top: -20px;
    }
    75% {
        top: -20px;
    }
    100% {
        top: 0;
    }
}


.table .player-container.player-4 .card .card-back {
    display: none;
}

.table .player-container.player-4 h2 {
    bottom: 0.25rem;
}

/* Cards */
.card {
    height: 175px;
    width: 40px;
    position: relative;
    transition-property: all;
    transition-duration: 0.3s;
    transition-timing-function: ease-in-out;
    top: 0px;
}

.card .bg {
    background-color: #fff;
    position: relative;
    height: 175px;
    width: 125px;
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border-style: solid;
    border-width: 1px;
    border-color: #cbd5e0;
}

.card .card-back {
    position: absolute;
    height: 100%;
    width: 100%;
    top: 0px;
    left: 0px;
    background-image: linear-gradient(to bottom right, #0ea5e9, #075985);
    /* background-color: #075985;
    background-image: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 0h20L0 20z' fill='%230ea5e9' fill-opacity='0.4' fill-rule='evenodd'/%3E%3C/svg%3E");
    background-color: #DFDBE5; */
    background-image: url("data:image/svg+xml,%3Csvg width='20' height='12' viewBox='0 0 20 12' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 12c0-.622-.095-1.221-.27-1.785A5.982 5.982 0 0 0 10 12c1.67 0 3.182-.683 4.27-1.785A5.998 5.998 0 0 0 14 12h2a4 4 0 0 1 4-4V6c-1.67 0-3.182.683-4.27 1.785C15.905 7.22 16 6.622 16 6c0-.622-.095-1.221-.27-1.785A5.982 5.982 0 0 0 20 6V4a4 4 0 0 1-4-4h-2c0 .622.095 1.221.27 1.785A5.982 5.982 0 0 0 10 0C8.33 0 6.818.683 5.73 1.785 5.905 1.22 6 .622 6 0H4a4 4 0 0 1-4 4v2c1.67 0 3.182.683 4.27 1.785A5.998 5.998 0 0 1 4 6c0-.622.095-1.221.27-1.785A5.982 5.982 0 0 1 0 6v2a4 4 0 0 1 4 4h2zm-4 0a2 2 0 0 0-2-2v2h2zm16 0a2 2 0 0 1 2-2v2h-2zM0 2a2 2 0 0 0 2-2H0v2zm20 0a2 2 0 0 1-2-2h2v2zm-10 8a4 4 0 1 0 0-8 4 4 0 0 0 0 8zm0-2a2 2 0 1 0 0-4 2 2 0 0 0 0 4z' fill='%23000000' fill-opacity='0.4' fill-rule='evenodd'/%3E%3C/svg%3E");
    border: 10px solid white;
    border-radius: 0.75rem;
    /*opacity: 0.2;*/
    box-sizing: border-box;
}

.card .card-value,
.card .suit-value {
    background-clip: text;
    -webkit-background-clip: text;
    background-color: #fca5a5;
    color: transparent;
    font-size: 25px;
    font-weight: 900;
    height: 30px;
    padding-top: 5px;
    text-align: center;
    width: 40px;
}

.card.clubs .card-value,
.card.spades .card-value,
.card.clubs .suit-value,
.card.spades .suit-value {
    background-image: linear-gradient(to bottom right, #0f172a, #020617);
}

.card.diamonds .card-value,
.card.hearts .card-value,
.card.diamonds .suit-value,
.card.hearts .suit-value {
    background-image: linear-gradient(to bottom right, #b91c1c, #7f1d1d);
}

.card .card-value {
    margin-top: 0.75rem;
    letter-spacing: -3px;
}

.card .suit-value {
    font-size: 20px;
    /* height: 30px; */
}

.card.disabled .suit-value,
.card.disabled .card-value {
    opacity: 0.25;
}

/* Debugging */
.debug {
    background: #333;
    color: white;
    display: flex;
    flex-wrap: wrap;
    padding: 3rem;
}

.debug .row {
    padding: 1rem;
    text-align: center;
}

.debug .row input {
    background: black;
    border-radius: 10px;
    border: none;
    color: #ccc;
    margin: 1rem;
    padding: 10px;
    text-align: center;
    width: 3rem;
}

/* Score */
#score {
    bottom: 0;
    color: white;
    /* display: flex; */
    display: none;
    flex-direction: column;
    padding: 20px;
    position: absolute;
    left: 0;
}

#score .row {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
}

#score .row div+div {
    margin-left: 50px;
}

#showLog {
    background: rgba(0, 0, 0, 0.5);
    border-radius: 10px;
    height: 50px;
    left: 10px;
    padding: 10px;
    position: absolute;
    top: 10px;
    width: 50px;
    z-index: 20;
}

#showLog svg, #scoreLog .close svg {
    height: 30px;
    width: 30px;
}

#scoreLog {
    background: rgba(0, 0, 0, 0.9);
    height: 100vh;
    display: none;
    left: 0;
    position: absolute;
    top: 0;
    width: 100vw;
    z-index: 25;
}

#scoreLog .close {
    height: 30px;
    left: 10px;
    padding: 10px;
    position: absolute;
    top: 10px;
    width: 30px;
    z-index: 30;
}

#scoreLog table {
    color: white;
    left: 0;
    position: absolute;
    text-align: center;
    top: 100px;
    width: 100%;
}

#scoreLog table th {
    width: 20%;
}

#scoreLog table th,
#scoreLog table td {
    padding-top: 10px;
}

#info {
    bottom: 0;
    color: white;
    left: 0;
    padding: 20px;
    position: absolute;
}

#toggleShowStuff {
    background: rgba(0, 0, 0, 0.5);
    border-radius: 10px;
    display: none;
    height: 50px;
    left: 10px;
    padding: 10px;
    position: absolute;
    top: 130px;
    width: 50px;
    z-index: 20;
}

#hideStuff {
    background: rgba(0, 0, 0, 0.5);
    border-radius: 10px;
    display: none;
    height: 50px;
    left: 10px;
    padding: 10px;
    position: absolute;
    top: 130px;
    width: 50px;
    z-index: 20;
}

#showStuff {
    background: rgba(0, 0, 0, 0.5);
    border-radius: 10px;
    height: 50px;
    left: 10px;
    display: none;
    padding: 10px;
    position: absolute;
    top: 130px;
    width: 50px;
    z-index: 20;
}

#autoToggle {
    background: rgba(0, 0, 0, 0.5);
    border-radius: 10px;
    color: #fff;
    cursor: pointer;
    font-size: 10px;
    height: 50px;
    left: 10px;
    line-height: 32px;
    padding: 10px;
    position: absolute;
    text-align: center;
    top: 70px;
    transition-property: opacity, background-color;
    transition-duration: 1s, 0s;
    width: 50px;
    z-index: 20;
}

/* Pass */
#pass {
    align-items: center;
    color: white;
    display: flex;
    flex-direction: column;
    height: 100vh;
    justify-content: center;
    left: 0;
    position: absolute;
    top: 0;
    width: 100vw;
    z-index: 10;
}

#pass.hidden {
    display: none;
}

#pass .pass {
    background: rgba(0,0,0,0.75);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    padding: 20px;
}

#pass #command {
    font-size: 20px;
    margin-bottom: 20px;
}
#pass #command .round {
    font-size: 16px;
    text-align: center;
    margin: 5px 0 10px;
    opacity: 0.75;
}

#pass button {
    background: rgba(241, 196, 15, 1.0);
    border: none;
    border-radius: 0.5rem;
    color: #fff;
    font-size: 20px;
    font-weight: 900;
    height: 40px;
    line-height: 45px;
    padding: 0 10px;
    text-shadow: 0px 0px 2px #000000, 1px 1px 0px #000000;
}

#pass button:disabled,
#pass button[disabled]{
  background: #ccc;
  opacity: 0.5;
}

/* Visual indicators */
#heartsBrokenIcon {
    background-clip: text;
    -webkit-background-clip: text;
    background-image: linear-gradient(to bottom right, #b91c1c, #7f1d1d);
    color: transparent;
    font-size: 50px;
    position: absolute;
    right: 20px;
    top: 20px;
    z-index: 20;
}

#moon {
    color: #f0e47d;
    font-size: 200px;
    left: calc(100vw - 150px);
    opacity: 0;
    position: absolute;
    top: calc(100vh - 200px);
}

#moon.animate {
    animation: mooning 3s linear forwards;
}

@keyframes mooning {
    0% {
        left: calc(100vw - 150px);
        opacity: 0;
        top: calc(100vh - 200px);
    }

    50% {
        opacity: 1;
    }

    100% {
        left: 0;
        opacity: 0;
        top: 0;
    }
}

/* Pics */
.player-pic {
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    display: none;
    /* height: calc(100vh - 215px); */
    height: 100vh;
    /* left: 175px; */
    left: 0;
    position: absolute;
    /* top: 40px; */
    top: 0;
    /* width: calc((100vw - 350px)/3); */
    width: 34vw;
    z-index: 0;
}

.player-pic.bg-2 {
    /* left: calc(175px + ((100vw - 350px)/3)); */
    left: 33vw;
}

.player-pic.bg-3 {
    /* left: calc(175px + ((100vw - 350px)/3) + ((100vw - 350px)/3)); */
    left: 66vw;
}

.player-pic div {
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    /* height: calc(100vh - 215px); */
    height: 100vh;
    left: 0;
    opacity: 0;
    position: absolute;
    top: 0;
    width: 100%;
    /* width: 100vw; */
    z-index: 0;
}

/* Mobile stylez */
@media (max-width: 991.98px) {
    .table .pile {
        height: calc(100vh - 200px);
        left: 40px;
        top: 40px;
        width: calc(100vw - 80px);
    }

    .table .pile .card.player-0 {
        margin-right: 0;
        left: 20px;
    }

    .table .pile .card.player-1 {
        top: 20px;
    }

    .table .pile .card.player-2 {
        left: auto;
        margin-left: 0;
        right: 105px;
    }

    .table .player-container.player-4 {
        flex-wrap: wrap;
        left: 10%;
        width: 80%;
    }

    .table .player-container.player-1 {
        width: 100dvh;
    }

    .table .player-container.player-1 h2 {
        left: auto;
        right: 10px;
        top: 15px;
    }

    .table .player-container.player-2 h2 {
        right: 70px;
    }

    .table .player-container.player-3 {
        right: -25px;
        rotate: 270deg;
        top: 50%;
        translate: 50% -50%;
        width: 100dvh;
    }

    .table .player-container.player-3 h2 {
        right: 75px;
        rotate: 90deg;
        transform-origin: right center;
        top: 15px;
    }

    .table .player-container.player-4 h2 {
        bottom: 0;
        right: -10%;
    }

    .table .player-container.player-4 .card {
        height: 50px;
        rotate: 0deg;
        translate: none;
    }

    .table .player-container:not(.player-4) .card {
        top: 20px;
        --card-fan-spread: -10vmin;
        transform-origin: center 1000px;
    }

    #heartsBrokenIcon {
        right: 5px;
        top: 0;
    }

    #score {
        background: rgba(0, 0, 0, 0.5);
        bottom: 155px;
        display: none;
        left: auto;
        padding: 0;
        right: 40px;
    }

    #score .row {
        padding: 0;
    }

    #score .row div {
        padding: 5px 10px 0;
    }

    #score .row:first-child div {
        padding: 10px 10px 0;
    }
}

/* Mobile portrait */
@media (max-width: 991.98px) and (orientation: portrait) {
    .player-pic, .player-pic div {
        height: 100vh;
        left: 0;
        top: 0;
        width: 100vw;
    }

    .player-pic.bg-2,
    .player-pic.bg-3 {
        left: 0px;
    }

    .player-pic.bg-1 {
        animation: pic-one 20s infinite;
    }

    @keyframes pic-one {
        0% {
            opacity: 1;
        }

        27% {
            opacity: 1;
        }

        33% {
            opacity: 0;
        }

        95% {
            opacity: 0;
        }

        100% {
            opacity: 1;
        }
    }

    .player-pic.bg-2 {
        animation: pic-two 20s infinite;
    }

    @keyframes pic-two {
        0% {
            opacity: 0;
        }

        27% {
            opacity: 0;
        }

        33% {
            opacity: 1;
        }

        62% {
            opacity: 1;
        }

        67% {
            opacity: 0;
        }

        100% {
            opacity: 0;
        }
    }

    .player-pic.bg-3 {
        animation: pic-three 20s infinite;
    }

    @keyframes pic-three {
        0% {
            opacity: 0;
        }

        62% {
            opacity: 0;
        }

        67% {
            opacity: 1;
        }

        95% {
            opacity: 1;
        }

        100% {
            opacity: 0;
        }
    }
}