/*
 * Estilos específicos para o jogo de Paciência. Este arquivo define a
 * aparência das pilhas de cartas, animações de movimento, além de layout
 * responsivo para desktop e dispositivos móveis. As cores foram escolhidas
 * para remeter à mesa de jogos verde e utilizar contraste adequado entre
 * cartas e fundo.
 */

html, body {
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    background-color: #076324;
    color: #fff;
    height: 100%;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: #044012;
    color: #ecf0f1;
}

nav button, nav .home-link {
    margin-right: 8px;
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    background: #e67e22;
    color: #fff;
    cursor: pointer;
    font-size: 0.9rem;
    text-decoration: none;
}
nav button:hover, nav .home-link:hover {
    background: #d35400;
}

#game-container {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.top-area {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.pile {
    width: 80px;
    height: 120px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.2);
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
    font-weight: bold;
}

.pile.stock {
    cursor: pointer;
}

.waste .card:last-child {
    margin-left: 0;
}

.foundations {
    display: flex;
    gap: 10px;
    margin-left: auto;
}

.foundation {
    width: 80px;
    height: 120px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
    font-weight: bold;

    position: relative;
}

/* Ícones de naipes nos espaços das fundações */
.foundation .suit-icon {
    position: absolute;
    top: 4px;
    left: 6px;
    font-size: 1.2rem;
    opacity: 0.6;
    pointer-events: none;
}
/* Oculta o ícone quando uma carta é colocada */
.foundation.has-card .suit-icon {
    display: none;
}

/* Destaque para locais onde a carta arrastada pode ser solta */
.drop-target {
    outline: 3px dashed #f1c40f;
}

/* Estilo da carta enquanto arrastada */
.dragging {
    opacity: 0.6;
}

.tableau {
    display: flex;
    gap: 10px;
    flex-grow: 1;
}

.tableau-pile {
    flex-grow: 1;
    min-height: 400px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    position: relative;
    padding-top: 15px;
}

.card {
    width: 80px;
    height: 120px;
    border-radius: 6px;
    background: #ffffff;
    color: #000;
    position: absolute;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    user-select: none;
    cursor: grab;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 4px;
    box-sizing: border-box;
    transition: transform 0.2s;
}

.card.face-down {
    background: #bdc3c7;
    color: transparent;
}

.card.red {
    color: #e74c3c;
}

.card.highlight {
    outline: 2px solid #f1c40f;
}

/* Modal geral compartilhado por todos os diálogos do jogo */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: #f5f5f5;
    color: #333;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    text-align: center;
}

.modal-content h2 {
    margin-top: 0;
}

.modal-content button {
    margin: 8px;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    background: #27ae60;
    color: #fff;
    cursor: pointer;
}

.modal-content button:hover {
    background: #1e8449;
}

.modal-content .close-btn {
    background: #c0392b;
}
.modal-content .close-btn:hover {
    background: #922b21;
}

/* Estilos para o ranking */
#ranking-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 200px;
    overflow-y: auto;
    text-align: left;
}

#ranking-list li {
    padding: 4px 0;
    border-bottom: 1px solid #ddd;
}

/* Responsividade para dispositivos menores */
@media (max-width: 600px) {
    .pile, .card {
        width: 60px;
        height: 90px;
    }
    .foundation {
        width: 60px;
        height: 90px;
    }
    .tableau-pile {
        min-height: 300px;
    }
    header h1 {
        font-size: 1.2rem;
    }
    nav button, nav .home-link {
        font-size: 0.7rem;
        padding: 4px 8px;
    }
}