@font-face {
    font-family: 'Roboto';
    src: url(../fonts/roboto-regular.woff);
}

@font-face {
    font-family: 'Roboto';
    src: url(../fonts/roboto-bold.woff);
    font-weight: bold;
}

:root {
    --table-color: #005000;
    --back-color: salmon;
    --card-width: calc(97vmin / 7 * 0.86);
    --card-height: calc((var(--card-width) * 3.5 / 2.5));   
    --table-width: calc(var(--card-width) * 7 + 44px);
    --table-height: calc(var(--table-width) * 5 / 6);
    --border-width: 1px;
}

html:hover {
    cursor: default;
}

body {
    font-family: 'Roboto', sans-serif;
    background: var(--table-color);
    margin: 0; 
    height: 100%; 
    overflow: hidden;
    opacity: 0;
    transition: opacity 1s ease;
}

.table {
    display: flex;
    position: relative;
    flex-direction: column;
    width: var(--table-width);
    height: var(--table-height);
    margin: auto;
    margin-top: 3vmax;
}

.row {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end; 
    width: var(--table-width);
    height: var(--card-height);
}

.row:not(:nth-child(1)):not(:nth-child(2)) {
    margin-top: calc(var(--card-height) / 5 * 3 * -1);
}

.row:nth-child(1) {
    margin-bottom: 30px;
}

.cell {
    display: grid;
    place-items: center;
    box-sizing: border-box;
    width: calc(var(--card-width) + var(--border-width) * 2);
    height: calc(var(--card-height) + var(--border-width) * 2);
    border: var(--border-width) solid var(--table-color);
    border-radius: calc(var(--card-width) / 10);
    color: var(--table-color);
    font-size:  calc(var(--card-width) / 1.5);
    font-weight: bold;
}

.cell:not(:first-child) {
    margin-left: 5px;
}

.foundation, .reset {
    border: var(--border-width) solid #003800;
    background-color:#003800;
}

.reset {
    cursor: pointer;
}

.circle {
    width: calc(var(--card-width) / 2.7);
    height: calc(var(--card-width) / 2.7);
    border: calc(var(--card-width) / 11) solid #005000;
    border-radius: 50%;
    background-color: transparent;
    transform: translateY(calc(var(--card-width) / 40));
}

.card-wrap {
    position: absolute;
    background-color: transparent;
    perspective: 1000px;
}

.card-wrap:hover {
    cursor: pointer;
}

.card {
    width: calc(var(--card-width) + var(--border-width) * 2);
    height: calc(var(--card-height) + var(--border-width) * 2);
    transform-style: preserve-3d;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.5s linear;
    transform-style: preserve-3d;
}

.front, .back {
    position: absolute;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    border-radius: calc(var(--card-width) / 10);
    box-sizing: border-box;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.front {
    background-color: white;
    border: var(--border-width) solid rgba(0,0,0,0.1);
    transform: rotateY(-180deg);
}

.back {
    background-color: var(--back-color);
    border: var(--border-width) solid white;
}

.card-wrap.flip .card-inner {
    transform: rotateY(-180deg);
}

.top {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: var(--card-width);
    height: calc(var(--card-height) / 3);
}

.rank {
    font-weight: bold;
    font-size: calc(var(--card-width) / 1.9);    
    pointer-events: none;
}

.ten {
    letter-spacing: calc(var(--card-width) / -10);
    text-indent: calc(var(--card-width) / -40);
}

.suit {
    display: flex;
    justify-content: center;
    align-items: center;
}

.suit img {
    width: calc(var(--card-height) / 3 * 0.8);
    height: calc(var(--card-height) / 3 * 0.8);
}

.main {
    display: flex;
    justify-content: center;
    align-items: center;
    width: var(--card-width);
    height: calc(var(--card-height) / 3 * 2);
}

.main img {
    margin-top: calc(var(--card-width) * 0.05);
    width: calc(var(--card-width) * 0.8);
    height: calc(var(--card-width) * 0.8);
}

img {
    pointer-events: none;
}

.red {
    color: red;
}

.black {
    color: black;
}

#designed {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    width: 100vw;
    color: white;
    font-size: 4vmin;
    opacity: 0;
}

@keyframes zoom {

    0% {
        transform: scale(1.0);
    }

    100% {
        transform: scale(1.1);
    }
}

@keyframes shake {
        
    33% {
        transform: translateX(3px); 
    }

    66% {
        transform: translateX(-3px); 
    }

    100% {
        transform: translateX(0);
    }
 }

@keyframes show {

    0% {
        opacity: 0;
    }

    100% {
        opacity: 0.5;
    }
}

.zoom {
    animation: zoom 0.25s 2 linear forwards alternate;
}

.shake {
    animation: shake 0.25s linear forwards;
}

.show {
    animation: show 3.0s 2 ease-in-out forwards alternate;
}

@media (orientation: landscape) {

    .table {
        margin-top: 10px;
    }
}

@media (min-width: 460px) and (min-height: 460px) {

    :root {
        --table-width: calc(var(--card-width) * 7 + 88px);
        --table-height: calc(var(--table-width) * 3 / 4);
        --border-width: 2px;
    }

    .row:not(:nth-child(1)):not(:nth-child(2))  {
        margin-top: calc(var(--card-height) / 3 * 2 * -1);
    }

    .row:nth-child(1) {
        margin-bottom: 50px;
    }

    .cell:not(:first-child) {
        margin-left: 10px;
    }

    .rank {
        font-size:  calc(var(--card-width) / 2.3);
    }

    .ten {
        letter-spacing: calc(var(--card-width) / -12);
    }

    .suit img {    
        width: calc(var(--card-height) / 3 * 0.70);
        height: calc(var(--card-height) / 3 * 0.70);
    }

    .main img {
        margin-top: 0;
        width: calc(var(--card-width) * 0.75);
        height: calc(var(--card-width) * 0.75);
    }

    #designed {
        font-size: 2.5vmin;
    }

    @media (orientation: landscape) {

        .table {
            margin-top: 30px;
        }
    }
}

.noselect {
    -webkit-tap-highlight-color: transparent;
          -webkit-touch-callout: none;
            -webkit-user-select: none; 
               -moz-user-select: none; 
                -ms-user-select: none; 
                    user-select: none; 
}
    