* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: Arial, sans-serif;
    background-color: #0d5016;
    color: white;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    overflow: hidden;
}

.game-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px;
    height: calc(100vh - 60px); /* Adjust for nav height */
    display: flex;
    flex-direction: column;
}

.controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    padding: 10px;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
}

.btn {
    padding: 8px 16px;
    background-color: #2c7a2c;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

.btn:hover {
    background-color: #3a8f3a;
}

.btn:active {
    background-color: #1e5e1e;
}

.draw-toggle {
    display: flex;
    gap: 15px;
}

.draw-toggle label {
    cursor: pointer;
}

.stats {
    margin-left: auto;
    display: flex;
    gap: 20px;
    font-size: 14px;
}

.game-board {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 100px);
}

.top-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 20px;
}

.stock-waste {
    display: flex;
    gap: 15px;
}

.foundations {
    display: flex;
    gap: 15px;
}

.tableau {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex: 1;
}

.pile {
    position: relative;
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    width: 100px;
    height: 140px;
}

.tableau-column {
    flex: 1;
    max-width: 100px;
    min-height: 140px;
    height: auto;
}

.card {
    position: absolute;
    width: 100px;
    height: 140px;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s;
    background-color: white;
    border: 1px solid #333;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
}

.card.dragging {
    opacity: 0.8;
    transform: rotate(5deg);
    z-index: 1000;
}

.card.face-down {
    background: linear-gradient(45deg, #1a4d2e 25%, #2d5436 25%, #2d5436 50%, #1a4d2e 50%, #1a4d2e 75%, #2d5436 75%, #2d5436);
    background-size: 20px 20px;
    border: 2px solid #0f3620;
}

.card.red {
    color: #d32f2f;
}

.card.black {
    color: #1a1a1a;
}

.card-rank {
    font-size: 32px;
    margin-bottom: 5px;
}

.card-suit {
    font-size: 40px;
}

.card-corner {
    position: absolute;
    font-size: 16px;
    font-weight: bold;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1;
}

.card-corner.top-left {
    top: 5px;
    left: 5px;
}

.card-corner.bottom-right {
    bottom: 5px;
    right: 5px;
    transform: rotate(180deg);
}

.pile.highlight {
    box-shadow: 0 0 15px 5px rgba(255, 255, 0, 0.5);
}

.pile.invalid {
    box-shadow: 0 0 15px 5px rgba(255, 0, 0, 0.5);
}

.tableau-column .card {
    position: absolute;
}

.win-screen {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 2000;
}

.win-screen.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.win-content {
    background-color: #2c7a2c;
    padding: 40px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5);
}

.win-content h2 {
    font-size: 36px;
    margin-bottom: 20px;
}

.win-content p {
    font-size: 20px;
    margin-bottom: 15px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .game-container {
        padding: 5px;
    }
    
    .controls {
        font-size: 12px;
        gap: 10px;
        padding: 8px;
    }
    
    .btn {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .stats {
        gap: 10px;
        font-size: 12px;
    }
    
    .pile {
        width: 60px;
        height: 84px;
    }
    
    .card {
        width: 60px;
        height: 84px;
        font-size: 16px;
    }
    
    .card-rank {
        font-size: 20px;
        margin-bottom: 2px;
    }
    
    .card-suit {
        font-size: 24px;
    }
    
    .card-corner {
        font-size: 10px;
    }
    
    .tableau-column {
        max-width: 60px;
        min-height: 84px;
    }
    
    .top-row {
        gap: 10px;
        margin-bottom: 15px;
    }
    
    .stock-waste {
        gap: 10px;
    }
    
    .foundations {
        gap: 5px;
    }
    
    .tableau {
        gap: 5px;
    }
}

@media (max-width: 480px) {
    .controls {
        justify-content: center;
    }
    
    .stats {
        margin-left: 0;
        width: 100%;
        justify-content: center;
    }
    
    .pile {
        width: 45px;
        height: 63px;
    }
    
    .card {
        width: 45px;
        height: 63px;
        font-size: 12px;
    }
    
    .card-rank {
        font-size: 16px;
    }
    
    .card-suit {
        font-size: 18px;
    }
    
    .card-corner {
        font-size: 8px;
    }
    
    .tableau-column {
        max-width: 45px;
        min-height: 63px;
    }
    
    .top-row {
        flex-direction: column;
        align-items: center;
    }
    
    .stock-waste, .foundations {
        justify-content: center;
    }
}

.modal {
    display: none;
    position: fixed;
    z-index: 3000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: #2c7a2c;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

.modal-header h2 {
    margin: 0;
    color: white;
}

.close-btn {
    color: white;
    font-size: 28px;
    cursor: pointer;
    transition: color 0.2s;
}

.close-btn:hover {
    color: #ccc;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

#move-list {
    color: white;
    line-height: 1.6;
}

.move-item {
    margin-bottom: 8px;
    padding: 10px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    transition: background-color 0.2s;
}

.move-item:hover {
    background-color: rgba(255, 255, 255, 0.15);
}

/* Victory animation */
.card.falling {
    position: fixed !important;
    transition: none;
    z-index: 4000 !important;
}

@keyframes cardBounce {
    0% {
        transform: translateY(0) rotate(0deg);
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
    }
}