#gameShell {
    height: 100%;
    width: 100%;
    display: grid;
    align-items: stretch;
    justify-items: stretch;
    background-color: #bfbaba;
}

@media (orientation: landscape) {
    #gameShell {
        grid-template-columns: 200px 3fr 2fr;
        grid-template-rows: 12vmin 1fr 12vmin 1fr;
    }

        #gameShell.spectator-mode {
            grid-template-rows: 12vmin 1fr 0px 0px;
        }

        #gameShell.cards-only-mode {
            grid-template-rows: 12vmin 0px 12vmin 1fr;
        }

    #gameMenu {
        grid-column: 2 / 4;
        grid-row: 1 / 2;
    }

    #gameTable {
        grid-column: 2 / 3;
        grid-row: 2 / 3;
    }

    #playerList {
        grid-column: 3 / 4;
        grid-row: 2 / 5;
    }

    .cards-only-mode > #playerList {
        grid-row: 2 / 3;
    }

    #playerActions {
        grid-column: 1 / 3;
        grid-row: 3 / 4;
    }

    #playerHand {
        grid-column: 1 / 3;
        grid-row: 4 / 5;
    }

    .cards-only-mode > #playerActions,
    .cards-only-mode > #playerHand {
        grid-column: 2 / 4;
    }
}

@media (orientation: portrait) {
    #gameShell {
        grid-template-columns: 2fr 1fr;
        grid-template-rows: 12vmin 1fr 94px 12vmin 1fr;
    }

        #gameShell.spectator-mode {
            grid-template-rows: 12vmin 1fr 94px 0px 0px;
        }

        #gameShell.cards-only-mode {
            grid-template-rows: 12vmin 0px 94px 12vmin 1fr;
        }

    #gameMenu {
        grid-column: 1 / -1;
        grid-row: 1 / 2;
    }

    #gameTable {
        grid-column: 1 / 2;
        grid-row: 2 / 3;
    }

    #playerList {
        grid-column: 2 / 3;
        grid-row: 2 / 3;
    }

    #playerActions {
        grid-column: 1 / -1;
        grid-row: 4 / 5;
    }

    #playerHand {
        grid-column: 1 / -1;
        grid-row: 5 / 6;
    }
}

#playerList {
    display: flex;
    flex-direction: column;
}

    #playerList > div {
        border: 1px solid #6f6a6a;
        background-color: #9f9a9a;
        border-radius: 9px;
        margin: 3px;
        padding: 5px;
        flex-basis: 100%;
        max-height: 7em;
    }

        #playerList > div.is-my-turn {
            background-color: #7f7a7a;
        }

        #playerList > div.is-finished {
            border-color: transparent;
            background-color: transparent;
            max-height: 3.3em;
        }

        #playerList > div > button {
            float: right;
        }

        #playerList > div > img {
            /* Most recently played card. */
            float: right;
            height: 3.5em;
        }

div.scroll {
    overflow-x: hidden;
    overflow-y: auto;
}

#exchangePrompt {
    float: right;
}

    #exchangePrompt img {
        height: 2em;
    }

.table-deck {
    /* Center the deck. */
    display: flex;
    align-items: center;
    justify-content: center;
}

    .table-deck img {
        position: absolute;
        height: 25vh;
    }

.table-explanation .tips img {
    height: 2em;
}

.spectator-mode .table-deck img {
    height: 50vh;
}

.cards-only-mode > #gameTable {
    display: none;
}

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

    .table-decks img {
        height: 25vh;
    }

.spectator-mode .table-decks img {
    height: 50vh;
}

.tips {
    border: 1px solid #6f6a6a;
    border-radius: 9px;
    margin: 3px;
}

.exchange-panel {
    height: 100%;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

    .exchange-panel .exchange {
        min-width: 0;
        border: 1px solid var(--line, #6f6a6a);
        border-radius: 9px;
        margin: 0;
        padding: 8px;
        display: grid;
        grid-template-columns: 3.5em minmax(0, 1fr);
        grid-template-rows: auto auto;
        gap: 4px 8px;
        background: var(--surface, #fff);
        color: var(--ink, #111);
    }

    .exchange-panel .exchange--passive {
        background: var(--surface-soft, #eee);
    }

    .exchange-panel .exchange--active {
        background: var(--accent-soft, #dceeff);
    }

    .exchange-panel .exchange .exchange-player img {
        width: 3em;
        height: 3em;
        object-fit: contain;
    }

    .exchange-panel .exchange .exchange-player {
        grid-column: 1 / 2;
        grid-row: 1 / 3;
    }

    .exchange-panel .exchange .exchange-title {
        grid-column: 2 / 3;
        grid-row: 1 / 2;
        font-weight: bold;
    }

    .exchange-panel .exchange .exchange-cards {
        grid-column: 2 / 3;
        grid-row: 2 / 3;
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        gap: 8px;
        min-width: 0;
    }

        .exchange-panel .exchange .exchange-cards > span {
            display: inline-flex;
            align-items: center;
            flex-wrap: wrap;
            gap: 8px;
        }

        .exchange-panel .exchange .exchange-cards img {
            height: 2em;
        }

    .exchange-panel .trade-status {
        display: block;
        flex-basis: 100%;
        color: var(--muted, #555);
        font-size: 0.9em;
    }

#playerActions.is-my-turn,
#playerHand.is-my-turn {
    animation: my-turn-background 10s;
}

@keyframes my-turn-background {
    0% {
        background-color: transparent;
    }

    2% {
        background-color: #000000;
    }

    3% {
        background-color: #000000;
    }

    5% {
        background-color: transparent;
    }

    100% {
        background-color: transparent;
    }
}

#gameIdDisplay {
    font-weight: bold;
    font-size: 150%;
}

#playerHand.card-hand {
    display: flex;
    align-items: stretch;
    overflow: hidden;
}

.hand-explanation > div {
    width: 67%;
}

.tips div {
    margin: 10px;
}

#playerHand.card-hand > span {
    flex-basis: 100%;
    width: 10px;
    max-width: 20vw;
}

    #playerHand.card-hand > span > img {
        border: 1px solid transparent;
        margin: 2px;
        padding: 1px;
        height: 30vmax;
        -webkit-filter: contrast(.5);
        filter: contrast(.5);
    }

.cards-only-mode > #playerHand > span > img {
    min-width: 2cm;
    width: 20vmin;
    max-width: 5cm;
}

#playerHand.card-hand.is-my-turn > span > img {
    -webkit-filter: none;
    filter: none;
}

#playerHand.card-hand > span > img:hover {
    border: 1px solid black;
}

input {
    font-size: 150%;
}

    input:invalid {
        border: 2px dashed red;
        animation: invalid-background 0.3s;
    }

@keyframes invalid-background {
    0% {
        background-color: white;
    }

    40% {
        background-color: red;
    }

    60% {
        background-color: red;
    }

    100% {
        background-color: white;
    }
}

#gameMenu > button > img {
    height: 6vmin;
}

#playerActions > button > img {
    height: 6vmin;
}

.dialog-footer > button > img {
    height: 56px;
}
