* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #fff;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px 0;
    border-bottom: 2px solid #e94560;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

header p {
    font-size: 1.1em;
    color: #ccc;
}

.view {
    display: none;
    animation: fadeIn 0.3s ease-in;
}

.view.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ===== DECKS GRID ===== */
.decks-grid {
    display: grid;
    /* Define colunas que se adaptam, mas nunca menores que 160px */
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 20px; /* Espaço obrigatório entre cartas */
    padding: 20px;
    align-items: start;
}

/* ESTRUTURA BASE DO CARD (MOLDURA) */
.deck-card {
    position: relative;
    width: 100%;
    /* Trava a proporção retangular (formato carta Magic/Poker) */
    aspect-ratio: 2.5 / 3.5;
    background-color: #2a2a3e;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.5);
    cursor: pointer;

    /* CRUCIAL: Impede que qualquer coisa saia de dentro da carta */
    overflow: hidden;
    transition: transform 0.2s;
}

.deck-card:hover {
    transform: scale(1.05);
    z-index: 10; /* Garante que o hover fique por cima, mas sem empurrar os vizinhos */
}

/* A IMAGEM DENTRO DO CARD */
.deck-card img {
    width: 100%;
    height: 100%;
    /* CRUCIAL: Preenche o espaço sem distorcer e corta o excesso */
    object-fit: cover;
    display: block;
}

/* TEXTO DO DECK (Sobreposto na parte inferior) */
.deck-card h3 {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px;
    text-align: center;
    font-size: 1rem;
    margin: 0;
    z-index: 2;
}

/* ===== IMAGES GALLERY ===== */
.images-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
    padding: 20px;
    border-bottom: 2px solid #e94560;
}

.btn-back {
    padding: 10px 20px;
    background-color: #e94560;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s;
}

.btn-back:hover {
    background-color: #d63447;
}

#deckTitle {
    flex: 1;
    font-size: 2em;
    text-transform: uppercase;
}

.images-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 20px; /* Espaço obrigatório entre cartas */
    padding: 20px;
    align-items: flex-start;
}

/* Container que recebe as cartas em lista (quando abre o deck) */
#imageContainer {
    display: flex;
    flex-direction: column;
    gap: 20px; /* Espaço entre uma carta e outra */
    width: 100%;
    margin-top: 10px;
}

/* ESTRUTURA BASE DO CARD (MOLDURA) */
.image-card {
    display: flex;
    flex-direction: row;
    gap: 20px;
    background-color: #2a2a3e;
    border-radius: 10px;
    padding: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.5);
    width: 100%;
    max-width: 600px;
}

.image-card img {
    width: 160px;
    height: auto;
    border-radius: 5px;
    object-fit: cover;
}

.image-description {
    flex: 1;
    color: #fff;
    font-size: 1rem;
    line-height: 1.5;
}

/* Estilo diferenciado para o nome da carta */
.image-description h3 {
    font-size: 1.15rem;
    font-weight: 800;
    color: #f3e8ff;
    margin: 0 0 8px 0;
    padding: 6px 10px;
    border-radius: 8px;
    background: linear-gradient(90deg, rgba(233,69,96,0.08), transparent);
    display: inline-block;
}

.no-images {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: #aaa;
}

/* ===== MODAL ZOOM ===== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    animation: fadeIn 0.3s ease-in;
}

.modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
}

.close {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 2em;
    font-weight: bold;
    color: #fff;
    cursor: pointer;
    z-index: 1001;
    transition: color 0.3s;
}

.close:hover {
    color: #e94560;
}

.zoom-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

#zoomImage {
    max-width: 100%;
    max-height: 85vh;
    cursor: zoom-in;
    object-fit: contain;
}

.zoom-controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    background-color: rgba(0, 0, 0, 0.7);
    padding: 10px;
    border-radius: 10px;
}

.zoom-btn {
    padding: 10px 20px;
    background-color: #e94560;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background-color 0.3s;
}

.zoom-btn:hover {
    background-color: #d63447;
}

/* ===== RESPONSIVO ===== */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.8em;
    }

    .decks-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 20px;
    }

    .deck-card {
        width: 150px;
        height: 230px;
    }

    .images-gallery {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }

    .images-header {
        flex-direction: column;
        align-items: flex-start;
    }

    #deckTitle {
        font-size: 1.4em;
    }
}
