:root {
    --name-height: 4vh;
    --aslt-max-card-height: calc((100vh - 2 * var(--name-height)) / 7.5);
    --aslt-max-card-width: calc(100vw / 10.5);

    --max-slot-height: min(var(--aslt-max-card-height), calc(var(--aslt-max-card-width) * 3.5 / 2.5));
    --max-slot-width: min(var(--aslt-max-card-width), calc(var(--aslt-max-card-height) * 2.5 / 3.5));
    --slot-scale: 0.9;

    --slot-height: calc(var(--max-slot-height) * var(--slot-scale));
    --slot-width: calc(var(--max-slot-width) * var(--slot-scale));

    --max-center-slot-height: calc(1.23 * var(--max-slot-height));
    --center-slot-height: calc(1.23 * var(--slot-height));
}

body {
    background-color: green;
    margin: 0px;
    overflow: hidden;
}

#container {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

.player-area {
    width: 100vw;
    height: calc(3 * var(--max-slot-height) + var(--name-height));
    position: absolute;
    
    display: grid;
    grid-template-rows: repeat(3, 1fr) var(--name-height);

    --rotation: 0;
  
    transform-origin: top;
    transform:
        translateY(50vh)
        rotate(calc(var(--rotation) * 1deg))
        translateY(calc(0.5 * var(--max-center-slot-height)))
    ;
}

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

#center-slot {
    position: absolute;
    top: calc(50vh - var(--slot-height) / 2);
    left: calc(50vw - var(--slot-width) / 2);
}

#monster-circle {
    --circle-diameter: calc(var(--max-center-slot-height) + 2 * var(--max-slot-height));
    width: var(--circle-diameter);
    height: var(--circle-diameter);

    position: absolute;
    top: calc(50vh - var(--circle-diameter) / 2);
    left: calc(50vw - var(--circle-diameter) / 2);

    background-color: darkgreen;
    border-radius: 50%;
}

#monster-deck {
    position: absolute;
    top: calc(50vh + var(--max-center-slot-height) / 2 + 2 * var(--max-slot-height));
    left: calc(50vw - 4 * var(--max-slot-width));
}

#monster-gy {
    position: absolute;
    top: calc(50vh + var(--max-center-slot-height) / 2 + 2 * var(--max-slot-height));
    left: calc(50vw - 5 * var(--max-slot-width));
}

#king-gy {
    position: absolute;
    top: calc(50vh + var(--max-center-slot-height) / 2 + 2 * var(--max-slot-height));
    left: calc(50vw - 6.5 * var(--max-slot-width));
}

#item-deck {
    position: absolute;
    top: calc(50vh + var(--max-center-slot-height) / 2 + 2 * var(--max-slot-height));
    left: calc(50vw + 3 * var(--max-slot-width));
}

#item-gy {
    position: absolute;
    top: calc(50vh + var(--max-center-slot-height) / 2 + 2 * var(--max-slot-height));
    left: calc(50vw + 4 * var(--max-slot-width));
}

.slot {
    width: var(--slot-width);
    height: var(--slot-height);
}

.slot > img {
    width: 100%;
    height: 100%;

    pointer-events: none;
    -moz-user-select: none;
    -webkit-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.hand {
    height: var(--slot-height)
}

.name {
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;

    font-family: font;
    font-size: var(--name-height);
    color: white;
}

.card > img {
    width: 100%;
    height: 100%;

    -moz-user-select: none;
    -webkit-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.card {
    width: var(--slot-width);
    height: var(--slot-height);
    
    --x-position: 0;
    --y-position: 0;
    --x-offset: 0;
    --fan-level: 0;

    pointer-events: none;
    position: absolute;
    transform:
        translateX(calc(var(--x-position) * 1px - var(--slot-width) / 2))
        translateY(calc(var(--y-position) * 1px - var(--slot-height) / 2))
    ;
    
    --y-rotation: 0;
    --z-rotation: 0;
    --z-index: 0;
    z-index: var(--z-index);
}

.card-front {
    backface-visibility: hidden;
    pointer-events: auto;
    position: absolute;
    transform:
        perspective(200px)
        rotateZ(calc(var(--z-rotation) * 1deg))
        translateX(calc(var(--x-offset) * var(--max-slot-width)))
        rotateY(calc(var(--y-rotation) * 1deg))

        translateY(var(--slot-height))
        rotateZ(calc(var(--fan-level) * 12deg))
        translateY(calc(-1 * var(--slot-height)))
    ;
}

.card-back {
    backface-visibility: hidden;
    pointer-events: auto;
    position: absolute;
    transform:
        perspective(200px)
        rotateZ(calc(var(--z-rotation) * 1deg))
        translateX(calc(var(--x-offset) * var(--max-slot-width)))
        rotateY(calc(var(--y-rotation) * 1deg + 180deg))
        
        translateY(var(--slot-height))
        rotateZ(calc(var(--fan-level) * 12deg))
        translateY(calc(-1 * var(--slot-height)))
    ;
}

.floating {
    transition: transform 0.6s ease-in-out;
}

.selected > img {
    border: 3px solid yellow;
    border-radius: 5px;
    margin: -3px;
}

/*****************************************************************************/

@font-face {
    font-family: font;
    src: url(../../resources/fonts/darkforest.woff2);
}

.modal {
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    padding: 10%;
    overflow: hidden;

    -moz-user-select: none;
    -webkit-user-select: none;
    -ms-user-select: none;
    user-select: none;

    position: absolute;
    top: 0;
    left: 0;
    z-index: 1000000000;

    background-color: black;
    color: red;
    font-family: font;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.name-entry-modal > h1 {
    font-size: min(20vh, 8vw);
    margin: 20px;
}

.name-entry-modal > h2 {
    font-size: min(15vh, 6vw);
    margin: 20px;
}

.name-entry-modal > input {
    color: red;
    background-color: black;
    font-family: font;
    font-size: min(15vh, 6vw);
    text-align: center;

    border: 2px solid red;
    border-radius: 15px;
    outline: none;
}

.error-modal {
    font-size: min(10vh, 4vw);
    display: none;
}
