:root {
    /* Paleta de cores do cliente */
    --primary-color: #0D66B0;
    --secondary-color: #ff7a17;
    --secondary-color-light: #ff9a4f; /* Tom mais claro para gradiente */
    --accent-color: #7a97ab;
    --light-color: #FFFFFF;
    --dark-color: #333333;
    --bg-color: #eef2f7; /* Cor de fundo principal */

    /* Unidades relativas para TV Vertical (9:16) */
    --card-size: 18vh;
    --gap-size: 2vh;
}

body {
    margin: 0;
    font-family: 'Poppins', sans-serif;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    color: var(--dark-color);
    background-color: var(--bg-color);
}

.container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    align-items: center;
}

#start-screen {
    justify-content: space-between;
}

.start-header {
    width: 100%;
    height: 30vh;
    background-color: var(--primary-color);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2vh;
    box-sizing: border-box;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 10;
    animation: slideDown 0.8s ease-out;
}

.start-header .logo {
    max-height: 13vh;
    margin-bottom: 2vh;
    
}

.start-header .title {
    font-size: 4.5vh;
    color: var(--light-color);
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 3px;
    margin: 0;
}

.start-main {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    /* Fundo com padrão geométrico sutil e confiável */
    background-color: #ffffff;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%230d66b0' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

#start-btn {
    font-size: 3.5vh;
    font-weight: 700;
    padding: 2.5vh 10vh;
    border: none;
    border-radius: 50px;
    color: white;
    cursor: pointer;
    text-transform: uppercase;
    /* Botão com gradiente vibrante */
    background-image: linear-gradient(45deg, var(--secondary-color) 0%, var(--secondary-color-light) 100%);
    box-shadow: 0 10px 25px rgba(255, 122, 23, 0.4);
    transition: all 0.3s ease-in-out;
    transform: scale(1);
    animation: fadeIn 1s ease-in 0.5s backwards;
}

#start-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 15px 35px rgba(255, 122, 23, 0.5);
}

.start-footer {
    width: 100%;
    height: 15vh;
    background-color: var(--accent-color);
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--light-color);
    font-size: 1.8vh;
    z-index: 10;
    animation: slideUp 0.8s ease-out;
}

.start-footer p {
    text-transform: uppercase;
    font-size: 2vh;
}

/* --- TELA DO JOGO (CORES ATUALIZADAS) --- */
#game-screen {
    max-width: 100vw;
    padding-top: 2vh;
    justify-content: flex-start;
}

.game-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2vh;
    padding: 0 5vw;
    flex-shrink: 0;
    box-sizing: border-box;
}

.game-header .logo {
    max-width: 35vw;
    max-height: 20vh;
}

#timer {
    font-size: 5vh;
    font-weight: 700;
    color: var(--light-color);
    background-color: var(--secondary-color);
    padding: 1vh 2.5vh;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

#game-board {
    display: grid;
    grid-template-columns: repeat(2, var(--card-size));
    gap: var(--gap-size);
    perspective: 1000px;
    flex-grow: 1;
    overflow-y: auto;
    justify-content: center;
    align-content: flex-start;
    padding: 1vh 5vw;
}

.card {
    width: var(--card-size);
    height: var(--card-size);
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s, opacity 0.4s;
    cursor: pointer;
}

.card.flipped {
    transform: rotateY(180deg);
}

.card.matched {
    transition: opacity 0.5s ease, transform 0.5s ease;
    opacity: 0;
    transform: scale(0.8);
    cursor: default;
}

.card-face {
    width: 100%;
    height: 100%;
    position: absolute;
    backface-visibility: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    overflow: hidden;
}

.card-front img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.card-front {
    background-color: var(--light-color);
    transform: rotateY(180deg);
}

.card-back {
    /* Lembre-se de trocar este placeholder pelo seu caminho real: url('../img/card_back.png') */
    background-image: url('../img/card_back.png');
    background-size: cover;
    background-position: center;
    border: 3px solid var(--light-color);
    box-sizing: border-box;
    transform: rotateY(0deg);
}

/* --- Contagem Regressiva --- */
#countdown-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex; justify-content: center; align-items: center;
    z-index: 100;
}
#countdown-text {
    font-size: 45vh; font-weight: 900; color: white;
    animation: countdown-zoom 1s ease-in-out infinite;
}

/* --- Popup (CORES ATUALIZADAS) --- */
#popup-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.7);
    display: flex; justify-content: center; align-items: center;
    z-index: 200; opacity: 0; transition: opacity 0.3s ease;
    pointer-events: none;
}
#popup-overlay.visible { opacity: 1; pointer-events: auto; }
.popup {
    background-color: white; padding: 5vh; border-radius: 20px;
    text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    max-width: 90%; width: 80vw; transform: scale(0.8);
    transition: transform 0.3s ease;
}
#popup-overlay.visible .popup { transform: scale(1); }
#popup-title {
    margin-top: 0; font-size: 6vh;
    color: var(--primary-color);
}
#popup-message { font-size: 2.5vh; margin-bottom: 30px; }
#restart-btn {
    font-size: 2.5vh; font-weight: 600; padding: 1.5vh 4vh;
    border: none; border-radius: 50px;
    background-color: var(--secondary-color);
    color: white; cursor: pointer; transition: all 0.3s ease;
}
#restart-btn:hover { transform: scale(1.05); opacity: 0.9; }

.hidden { display: none !important; }

/* --- ANIMAÇÕES --- */
@keyframes slideDown {
    from { transform: translateY(-100%); }
    to { transform: translateY(0); }
}
@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}
@keyframes countdown-zoom {
    0% { transform: scale(0.5); opacity: 0; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(1); opacity: 0; }
}

/* Responsividade para telas deitadas (fallback) */
@media (orientation: landscape) {
    #game-board {
        grid-template-columns: repeat(4, var(--card-size));
    }
}

