/* Reset básico */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #2c2c2c;
    color: #f0f0f0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: visible;
}

header,
footer {
    text-align: center;
    padding: 1rem;
    background-color: #1a1a1a;
}

h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

p {
    font-size: 1rem;
}

.intro-text {
    font-size: 1.5rem;
}

main {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

.deck {
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: visible;
    /* allow card lift */
}

.row {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
    /* aumentar espaço vertical entre fileiras */
    overflow: visible;
    /* allow card lift */
    perspective: 1000px;
}

.deck {
    display: flex;
    flex-direction: column;
    align-items: center;
    perspective: 1000px;
}

.row {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
    /* aumentar espaço vertical entre fileiras */
}

/* Cartas empilhadas em 3 fileiras com sobreposição */
.card:not(:first-child) {
    margin-left: -40px;
    /* restored overlap for original design */
}

.card {
    width: 100px;
    height: 150px;
    background-color: #444;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
    position: relative;
    cursor: pointer;
    transition: transform 0.6s, box-shadow 0.6s;
    user-select: none;
    overflow: visible;
    border: 2px solid #FFFFFF;
}

.card:hover {
    z-index: 10000;
    transform: translateY(-20px) scale(1);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.8), 0 8px 16px rgba(255, 255, 255, 0.6);
}

/* Flip da carta */
.card.flipped {
    transform: rotateY(180deg) scale(1.1);
    z-index: 100;
    transform-style: preserve-3d;
}

.card.flipped:hover {
    transform: rotateY(180deg) translateY(-20px) scale(1.1);
}

.card .front,
.card .back {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 8px;
    backface-visibility: hidden;
    overflow: hidden;
}

.card .front {
    background-color: #222;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    color: #eee;
}

.card .back {
    background-color: #fff;
    color: #000;
    transform: rotateY(180deg);
    display: flex;
    justify-content: center;
    align-items: center;
}

.card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Estilos para resultado.php */
.result {
    background: rgba(0, 0, 0, 0.5);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.3);
    max-width: 900px;
    margin: 0 auto;
}

.result .content {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    /* reduzir espaço entre imagem e texto na tela grande */
}

.result img {
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
    border-radius: 8px;
}

@media (max-width: 768px) {
    .result .content {
        flex-direction: column;
        gap: 10px;
    }

    .result p {
        text-align: center;
        /* centralizar texto no mobile */
        margin: 0 auto;
        max-width: 100%;
        font-size: 2rem;
        /* fonte ainda maior no mobile */
    }

    .result img {
        display: block;
        margin: 0 auto;
        /* centralizar imagem no mobile */
    }

    .result h1 {
        font-size: 2rem;
        /* reduzir tamanho do h1 no mobile */
    }

    .result h2 {
        text-align: center;
        /* centralizar título no mobile */
        font-weight: bold;
        /* destacar h2 */
        text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
        /* brilho no h2 */
        margin-top: 7px;
        /* adicionar espaço acima do h2 */
        margin-bottom: 20px;
        /* adicionar espaço abaixo do h2 */
    }
}

.result h2 {
    text-align: center;
    /* centralizar h2 acima da carta na tela grande */
}

.result p {

    flex: 1;
    font-size: 1.4rem;
    /* aumentar fonte na tela grande */
}

/* Responsividade */
@media (max-width: 768px) {
    .card {
        width: 70px;
        height: 105px;
    }

    .card:not(:first-child) {
        margin-left: -30px;
    }

    .deck {
        max-width: 100%;
        gap: 0.3rem;
    }

    h1 {
        font-size: 2.5rem;
    }

    p {
        font-size: 0.9rem;
    }

    .intro-text {
        font-size: 1.8rem;
    }

    .index-main {
        padding: 0;
        margin-bottom: 100px;
    }

    header {
        margin-bottom: 30px;
    }
}

/* Desktop spacing adjustments for new navigation */
@media (min-width: 921px) {
    .index-main {
        padding-top: 20px;
        margin-bottom: 50px;
    }

    .result {
        margin-top: 20px;
        margin-bottom: 50px;
    }

    /* Adjust spacing for cards to prevent sticking to footer */
    .deck {
        margin-top: 20px;
        margin-bottom: 40px;
    }
}

/* Estilos para preload.html */
.preload-container {
    text-align: center;
    padding: 2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
}

.loader {
    border: 8px solid rgba(255, 255, 255, 0.3);
    border-top: 8px solid #fff;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 2s linear infinite;
    margin: 0 auto;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.preload-text {
    font-size: 1.5rem;
    margin-top: 1rem;
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    animation: fadeIn 2s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Botões modernos */
.button {
    display: inline-block;
    padding: 12px 24px;
    margin: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s, box-shadow 0.3s;
    font-weight: bold;
    text-align: center;
}

.button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
}

.buttons-container {
    text-align: center;
}