* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    min-height: 100vh;
    background: #afd33d;
    font-family: Arial, sans-serif;
}

/* Navigation */

.transform-nav {
    display: flex;
    justify-content: space-between;
    padding: 1.5rem 2rem;
}

.transform-nav a {
    color: white;
    font-weight: 700;
    text-decoration: none;
}

.transform-nav a:hover {
    opacity: 0.7;
}

/* Main layout */

.game {
    padding: 1rem 2rem 3rem;
}

.game-layout {
    width: min(1500px, 100%);
    min-height: 75vh;
    margin: 0 auto;

    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

/* Left third */

.card-area {
    display: grid;
    grid-template-rows: auto 1fr;
    gap: 2rem;
    min-width: 0;
}

.deck {
    justify-self: center;

    width: 150px;
    aspect-ratio: 2 / 3;

    border: 4px solid white;
    border-radius: 14px;
    background: #84a92a;

    /* stacked cards */
    box-shadow:
        5px 5px 0 #afd33d,
        8px 8px 0 white,
        13px 13px 0 #84a92a,
        16px 16px 0 white,
        0 12px 20px rgba(0, 0, 0, 0.20);
}

.drawn-cards {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.25rem;
}

.card {
    width: clamp(120px, 11vw, 165px);
    aspect-ratio: 2 / 3;

    border: 4px solid white;
    border-radius: 14px;
    background: #84a92a;
    color: white;

    font-size: 1.1rem;
    font-weight: 700;

    cursor: pointer;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.22);
}

.card:hover {
    transform: translateY(-4px);
}

/* Card dealing animation */

.card {
    transition:
        transform 0.45s ease,
        opacity 0.35s ease;
}

.card.dealing {
    opacity: 0;
    transform: translateY(-180px) scale(0.8);
}

.card.dealt {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.card.leaving {
    opacity: 0;
    transform: translateY(-120px) scale(0.85);
}

.card img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* Right two-thirds */

/* Tree display */

.tree-panel {
    min-height: 650px;
    padding: 2rem;

    display: flex;
    justify-content: center;
    align-items: center;

    background: white;
    border-radius: 18px;
    overflow: hidden;
}

.tree {
    width: 100%;
    min-height: 560px;

    display: flex;
    justify-content: center;
    align-items: center;
}

.tree-step {
    width: 90%;
    height: auto;
    max-height: 90%;
    object-fit: contain;
}

.end-modal {
    position: fixed;
    inset: 0;
    display: none;
    justify-content: center;
    align-items: center;

    background: rgba(0, 0, 0, 0.45);
    z-index: 1000;
}

.end-modal.show {
    display: flex;
}

.end-modal-content {
    width: min(450px, 85%);
    padding: 2rem;

    background: #E97862;
    border: 4px solid white;
    border-radius: 18px;

    color: white;
    text-align: center;
    font-size: 1.3rem;
    font-weight: 700;

    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
}

.end-modal-content > p {
    margin: 0.35rem 0;
}

#resetGame,
.next-transform {
    display: inline-block;
    padding: 0.8rem 2rem;

    border: 3px solid white;
    border-radius: 10px;
    background: #84a92a;

    color: white;
    font-family: Arial, sans-serif;
    font-size: 1rem;
    font-weight: 700;
    line-height: normal;
    text-decoration: none;

    cursor: pointer;
}

#resetGame {
    margin-top: 1rem;
}

.more-experiences {
    margin-top: 1rem;
}

.more-experiences p {
    margin: 0.25rem 0;
}

.next-transform {
    margin-top: 0.75rem;
}

#resetGame:hover,
.next-transform:hover {
    opacity: 0.8;
}

/* Mobile */


@media (max-width: 800px) {

    .card-area {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 0.75rem;
    }

    .deck {
        width: 90px;
        flex-shrink: 0;
    }

    .drawn-cards {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 0.75rem;
        margin-bottom: 0;
    }

    .card {
        width: 90px;
        flex-shrink: 0;
    }

    .game {
        padding: 1rem;
    }

    .game-layout {
        grid-template-columns: 1fr;
    }

    .tree-panel {
        min-height: 300px;
    }

    .tree {
        min-height: 300px;
    }

    .tree-step {
        width: 180%;
        max-width: none;
        max-height: none;
        height: auto;
        flex-shrink: 0;
        transform: translateX(35px);
    }

    .next-transform {
    display: inline-block;
    padding: 0.8rem 2rem;

    border: 3px solid white;
    border-radius: 10px;
    background: #84a92a;

    color: white;
    font-weight: 700;
    text-decoration: none;

    cursor: pointer;    
    }

    .next-transform:hover {
    opacity: 0.8;
    }
}