/* :root {
    --card-width: 70px;
    --card-height: 100px;
    --deck-gap: 40px;
} */

:root {
    --card-width: 8.5vh;
    --card-height: calc(var(--card-width) * 1.4);
    --deck-gap: 5vh;
}

html {
    max-height: 100vh;
    overflow: hidden;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #2e7d32;
    background-image: radial-gradient(#388e3c 40%, #1b5e20 100%); 
    color: white;
    margin: 0;
    /* padding: 20px; */
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
    max-height: 100vh
}

header {
    width: 100vw;
    height: 10vh;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    border-bottom: solid 1px #fff;
    background-color: #0002;
    margin-bottom: 10px;
}

main {
    height: 85vh;
}

footer {
    width: 100vw;
    height: 5vh;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    border-top: solid 1px #fff;
    background-color: #0002;
}

h1 { 
    text-shadow: 2px 2px 4px rgba(0,0,0,0.4);
}

.info-panel {
    font-size: 16px;
    margin-bottom: 15px;
    background: rgba(0,0,0,0.3);
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.5);
    padding: 5px 20px;
    border-radius: 15px;
    display: flex;
    gap: 25px;
}

.controls { 
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
    display: flex;
    justify-content: space-around;
}

button {
    padding: 10px 20px;
    font-size: 16px;
    background-color: #1565c0;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

button:hover { background-color: #0d47a1; }
button:active { transform: translateY(2px); box-shadow: 0 2px 3px rgba(0,0,0,0.3); }

button:disabled {
    background-color: #558b2f;
    color: rgba(255,255,255,0.4);
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    position: relative;
}

.pyramid {
    position: relative;
    width: 100%;
    margin-bottom: 20px;
}

.card {
    position: absolute;
    width: var(--card-width);
    height: var(--card-height);
    background-color: white;
    border-radius: 6px;
    box-shadow: 
        0 1px 1px rgba(0,0,0,0.2),
        2px 3px 6px rgba(0,0,0,0.4),
        inset 0 1px 0 rgba(255,255,255,0.8);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 5px;
    box-sizing: border-box;
    cursor: pointer;
    user-select: none;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s;
}

.card.red { 
    color: #d32f2f; 
}

.card.black { 
    color: #212121; 
}

.card .suit {
    font-size: 2vh;
    align-self: center;
    text-shadow: 1px 1px 1px rgba(0,0,0,0.15);
}

.card .rank-top { 
    align-self: flex-start; 
    font-weight: bold; 
}

.card .rank-bottom { 
    align-self: flex-end; 
    font-weight: bold; 
    transform: rotate(180deg); }

.card.selected {
    transform: translateY(-12px) scale(1.03);
    box-shadow: 
        0 0 15px #ffeb3b, 
        4px 14px 20px rgba(0,0,0,0.5);
    border: 2px solid #ffeb3b;
    z-index: 999 !important;
}

.card.covered {
    filter: brightness(0.65);
    cursor: not-allowed;
    box-shadow: 1px 2px 4px rgba(0,0,0,0.3);
}

.deck-area {
    display: flex;
    gap: var(--deck-gap);
    justify-content: center;
    margin-top: 20px;
    position: absolute;
    top: 53vh;
}

.deck-slot {
    width: var(--card-width);
    height: var(--card-height);
    border: 2px dashed rgba(255,255,255,0.25);
    border-radius: 6px;
    position: relative;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.4);
}

.slot-label {
    text-align: center;
    font-size: 12px;
    margin-bottom: 5px;
    color: #c8e6c9;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.card.back {
    background: linear-gradient(135deg, #0d47a1 25%, transparent 25%) -50px 0,
                linear-gradient(225deg, #0d47a1 25%, transparent 25%) -50px 0,
                linear-gradient(45deg, #0d47a1 25%, transparent 25%),
                linear-gradient(35deg, #0d47a1 25%, transparent 25%);
    background-size: 20px 20px;
    background-color: #1565c0;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-weight: bold;
    font-size: 18px;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.8);
    box-shadow: 
        0 1px 1px rgba(0,0,0,0.2),
        2px 3px 6px rgba(0,0,0,0.4),
        inset 0 1px 0 rgba(255,255,255,0.4);
}

.deck-slot.has-cards::before {
    content: '';
    position: absolute;
    top: 4px;
    left: 2px;
    width: 100%;
    height: 100%;
    background-color: #cacaca;
    border-radius: 6px;
    box-shadow: 3px 4px 6px rgba(0, 0, 0, 0.45);
    z-index: 1;
    pointer-events: none;
    border: 1px solid #a0a0a0;
    box-sizing: border-box;
}

.deck-slot.has-cards::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 100%;
    height: 100%;
    background-color: #e0e0e0;
    border-radius: 6px;
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.35);
    z-index: 2;
    pointer-events: none;
    border: 1px solid #b8b8b8;
    box-sizing: border-box;
}

#deck.has-cards::before {
    background-color: #0a3a80;
    border: 1px solid #062857;
}
#deck.has-cards::after {
    background-color: #115293;
    border: 1px solid #0c3e70;
}

.deck-slot .card {
    z-index: 5;
    transform: translate(-1px, -2px); 
}

.deck-slot .card.selected {
    transform: translate(-2px, -15px) scale(1.03);
}

.card.animating {
    position: absolute;
    z-index: 999;
    pointer-events: none;
    animation: drawCardAnim 0.25s ease-in-out forwards;
}

@keyframes drawCardAnim {
    0% { transform: translate(-2px, -3px); }
    100% { transform: translate(calc(var(--card-width) + var(--deck-gap) - 2px), -3px); }
}

.card.fly-away {
    z-index: 1000;
    pointer-events: none;
    animation: flyOutAnim 0.65s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes flyOutAnim {
    0% {
        transform: translate(-2px, -3px) scale(1) rotate(0deg);
        opacity: 1;
    }
    25% {
        transform: translate(-2px, -25px) scale(1.06) rotate(4deg);
        opacity: 1;
        box-shadow: 5px 15px 25px rgba(0,0,0,0.5);
    }
    100% {
        transform: translate(50px, 600px) scale(0.6) rotate(-30deg);
        opacity: 0;
    }
}

@media (orientation: portrait) {
    
    :root {
        --card-width: 8.5vw;
        --card-height: calc(var(--card-width) * 1.4);
        --deck-gap: 5vw;
    }
    
}