@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));
    --border-width: 1px;
}

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

body:hover {
    cursor: default;
}

#outer {
    display: table;
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
}
  
#middle {
    display: table-cell;
    vertical-align: middle;
}
  
#inner {
    margin-left: auto;
    margin-right: auto;
}

.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: center; 
    width: var(--table-width);
    height: var(--card-height);
}

.row:not(:first-child) {
    margin-top: calc(var(--card-height) / -2);
}

.row:nth-child(8) {
    margin-top: 40px;
}

.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);
}

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

.stock {
    width: calc(var(--card-width) + var(--border-width) * 2);
    height: calc(var(--card-height) + var(--border-width) * 2);
    margin-left: 27px;
    border-radius: calc(var(--card-width) / 10);
}

.pile {
    width: calc(var(--card-width) + var(--border-width) * 2);
    height: calc(var(--card-height) + var(--border-width) * 2);
    border-radius: calc(var(--card-width) / 10);
}

.card-wrap {
    position: absolute;
    cursor: pointer;
    background-color: transparent;
    opacity: 0;
    left: -300px;
    perspective: 1000px;
} 

.card {
    position: relative;
    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;
    transform-style: preserve-3d;
    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: calc(var(--card-width));
    height: calc(var(--card-height) / 3);
}

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

.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: calc(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;
}

#designed {
    position: absolute;
    width: 100%;
    color: white;
    top: calc(var(--table-height) / 2);
    font-size: 4.0vmin;
    text-align: center;
    align-self: auto;
    opacity: 0;
}

@keyframes show {

    0% {
        opacity: 0;
    }

    100% {
        opacity: 0.5;
    }
}

@keyframes zoom {

    0% {
        transform: scale(1.0);
    }

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

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

.zoom {
    animation: zoom 0.25s 2 linear 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));
        --border-width: 2px;
    }

    .table {
        margin-top: 50px;
    }

    .front {
        border: var(--border-width) solid rgba(0,0,0,0.05);
    }
    
    .back {
        border: var(--border-width) solid white;
    }

    .stock {
        margin-left: 50px;
    }

    .row:nth-child(8) {
        margin-top: 60px;
    }

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

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

    .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; 
}