/* Adicionando uma animação de pulso para o verso da carta */
@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 0.7;
    }
    50% {
        transform: scale(1.1);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 0.7;
    }
}

/* Animação para quando um par é encontrado */
@keyframes shrinkAndGlow {
    0% {
        transform: scale(1.05) rotateY(180deg);
        box-shadow: 0 0 15px 5px rgba(255, 215, 0, 0.6);
    }
    100% {
        transform: scale(0) rotateY(180deg);
        box-shadow: 0 0 25px 10px rgba(255, 215, 0, 1);
        opacity: 0;
    }
}

/* Animações de transição de tela */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

.fade-in { animation: fadeIn 0.6s ease-out forwards; }
.fade-out { animation: fadeOut 0.5s ease-in forwards; }

@keyframes timer-warning-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}
/* Animação para as estrelas e planetas */
@keyframes move-twinkle-stars {
    from { background-position: 0 0; }
    to { background-position: -10000px 5000px; }
}
@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
    100% { transform: translateY(0px); }
}




/* Estilos gerais para a página */
body {
    /* Paleta de Cores "Gamificada" */
    --primary-color: #00d9ff; /* Ciano Elétrico */
    --primary-dark: #00a2c2;
    --secondary-color: #ff00c1; /* Rosa Magenta */
    --accent-pink: #ff6fb5;
    --accent-purple: #9b5cff;

    --text-color: #e0e0e0;
    --bg-dark: #121212;
    --bg-panel: rgba(0, 0, 0, 0.2);

    font-family: 'Poppins', sans-serif;
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Alinha o conteúdo no topo para evitar cortes */
    min-height: 100vh;
    /* Fundo escuro e sofisticado */
    background: radial-gradient(ellipse at bottom, #1B2735 0%, #090A0F 100%);
    margin: 0;
    padding: 15px;
    box-sizing: border-box;
    color: var(--text-color);
}

/* Estilos do Fundo Parallax */
.parallax-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}

.stars1, .stars2, .stars3 {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    display: block;
    background: transparent;
    background-repeat: repeat;
    background-size: cover;
    animation: move-twinkle-stars 200s linear infinite;
}

.stars1 {
    background-image: url('data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIGlkPSJMYXllcl8xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiIHk9IjBweCIgd2lkdGg9IjEwMHB4IiBoZWlnaHQ9IjEwMHB4IiB2aWV3Qm94PSIwIDAgMTAwIDEwMCIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAwIDAgMTAwIDEwMCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PGNpcmNsZSBmaWxsPSIjRkZGRkZGIiBjeD0iNTAiIGN5PSI1MCIgcj0iMC41Ii8+PC9zdmc+');
}
.stars2 {
    background-image: url('data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIGlkPSJMYXllcl8xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiIHk9IjBweCIgd2lkdGg9IjEwMHB4IiBoZWlnaHQ9IjEwMHB4IiB2aWV3Qm9yPSIwIDAgMTAwIDEwMCIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAwIDAgMTAwIDEwMCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PGNpcmNsZSBmaWxsPSIjRkZGRkZGIiBjeD0iNTAiIGN5PSI1MCIgcj0iMSIvPjwvc3ZnPg==');
    animation-duration: 150s;
}
.stars3 {
    background-image: url('data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIGlkPSJMYXllcl8xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiIHk9IjBweCIgd2lkdGg9IjEwMHB4IiBoZWlnaHQ9IjEwMHB4IiB2aWV3Qm9yPSIwIDAgMTAwIDEwMCIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAwIDAgMTAwIDEwMCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PGNpcmNsZSBmaWxsPSIjRkZGRkZGIiBjeD0iNTAiIGN5PSI1MCIgcj0iMS41Ii8+PC9zdmc+');
    animation-duration: 100s;
}

.planet {
    position: absolute;
    border-radius: 50%;
    animation: float 6s ease-in-out infinite;
}
.p1 {
    width: 80px; height: 80px; top: 15%; left: 10%;
    background: radial-gradient(circle at 20% 20%, var(--accent-pink), var(--accent-purple));
    filter: drop-shadow(0 0 15px var(--accent-pink));
}
.p2 {
    width: 40px; height: 40px; bottom: 20%; right: 15%;
    background: radial-gradient(circle at 70% 70%, var(--primary-color), var(--accent-purple));
    filter: drop-shadow(0 0 10px var(--primary-color));
    animation-duration: 8s;
}
.p3 {
    width: 60px; height: 60px; top: 40%; right: 30%;
    background: radial-gradient(circle at 30% 70%, var(--secondary-color), var(--accent-pink));
    filter: drop-shadow(0 0 12px var(--secondary-color));
    animation-duration: 7s;
}

/* Estilos para a Hero Page */
.hero-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    max-width: 600px;
    position: relative; /* Garante que fique acima do fundo */
    padding: 20px;
}

.hero-title {
    font-size: 2.5rem;
    font-family: 'Bungee', cursive;
    color: var(--primary-color);
    /* Novo estilo de título com contorno e sombra para legibilidade */
    -webkit-text-stroke: 1.5px #000;
    text-shadow: 3px 3px 0px var(--secondary-color);
    margin-bottom: 0.5rem;
}

.tagline {
    font-size: 1.1rem;
    color: var(--text-color);
    margin-bottom: 2rem;
    background: var(--bg-panel);
    padding: 8px 25px;
    border-radius: 50px;
    border: 1px solid var(--primary-color);
    font-weight: 600;
    letter-spacing: 1px;
}

/* Estilos para o Seletor de Modo */
.mode-selector {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 2rem;
    font-weight: 600;
}
.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--primary-color);
    transition: .4s;
    border-radius: 34px;
}
.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}
input:checked + .slider {
    background-color: var(--secondary-color);
}
input:checked + .slider:before {
    transform: translateX(26px);
}

.instructions {
    background: var(--bg-panel);
    border: 2px solid var(--primary-color);
    box-shadow: inset 0 0 15px rgba(0, 217, 255, 0.3);
    border-radius: 10px;
    padding: 1.5rem 2rem;
    margin-bottom: 2rem;
    text-align: left;
}

.instructions h3 {
    text-align: center;
    color: #fff;
    margin-top: 0;
}

.instructions ul {
    list-style: none;
    padding: 0;
}

.instructions li {
    margin-bottom: 0.5rem;
    color: rgba(255, 255, 255, 0.8);
}

.instructions li span {
    color: var(--primary-color);
    font-weight: 600;
    margin-right: 0.5rem;
}

.game-container {
    display: none; /* Escondido por padrão */
    flex-direction: column;
    position: relative; /* Garante que fique acima do fundo */
    align-items: center;
    background: transparent; /* Fundo transparente para revelar o cenário */
    padding: 30px;
    border-radius: 20px;
    border: 2px solid var(--primary-color);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37), inset 0 0 20px rgba(0, 217, 255, 0.2);
    width: 100%;
    max-width: 800px;
}

.game-title {
    font-family: 'Bungee', cursive;
    color: var(--primary-color);
    /* Novo estilo de título com contorno e sombra para legibilidade */
    -webkit-text-stroke: 1.5px #000;
    text-shadow: 3px 3px 0px var(--secondary-color);
    margin: 0 0 20px 0;
}

/* Painel de Configurações do Jogo */
.game-settings {
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    gap: 10px;
}

.difficulty-selector, .theme-selector {
    background: var(--bg-panel);
    padding: 10px 15px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Estilos para os botões de dificuldade */
.difficulty-btn {
    padding: 8px 16px;
    font-size: 16px;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    border: none;
    border-radius: 8px;
    background-color: rgba(0,0,0,0.2);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.7);
    transition: background-color 0.3s, transform 0.2s;
}

.difficulty-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
    transform: translateY(-2px);
}

.difficulty-btn.active {
    background-color: var(--secondary-color);
    color: #fff;
    font-weight: 600;
    border-color: var(--secondary-color);
}

/* Estilos para o seletor de temas */
.theme-selector {
    color: rgba(255, 255, 255, 0.7);
    font-size: 16px;
}

#theme-select {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    padding: 5px 8px;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
}

#theme-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Estilo para as opções dentro do seletor de tema */
#theme-select option {
    background: #2c2c2c;
}

/* Estilos para as estatísticas do jogo */
.game-stats {
    margin: 20px auto;
    font-size: 18px;
    color: var(--text-color);
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    width: 100%;
    max-width: 400px;
}

.game-stats span {
    padding: 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: var(--bg-panel);
    text-align: center;
}

.timer-warning {
    color: #ff4d4d;
    animation: timer-warning-pulse 1s infinite;
    font-weight: 700;
}

/* Estilos do tabuleiro do jogo */
.game-board {
    display: grid;
    gap: 15px;
    margin-top: 20px;
    justify-content: center;
    perspective: 1000px;
}

/* Estilos de cada carta */
.card {
    aspect-ratio: 1 / 1;
    position: relative;
    cursor: pointer;
    transform-style: preserve-3d;
    transition: transform 0.6s, box-shadow 0.3s;
}

.card:hover {
    /* Efeito de brilho ao passar o mouse */
    box-shadow: 0 0 15px 5px rgba(0, 217, 255, 0.4);
    z-index: 10;
}

.card.flip {
    transform: rotateY(180deg);
}

/* Estilo para a carta quando um par é encontrado */
.card.matched {
    animation: shrinkAndGlow 0.8s ease-in-out forwards;
    cursor: default;
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: clamp(24px, 5vw, 40px);
    overflow: hidden;
}

.card-front {
    /* Fundo da carta com emoji: um círculo com brilho */
    background: #2c2c2c;
    background-image: radial-gradient(circle, rgba(0, 217, 255, 0.2) 0%, transparent 70%);
    transform: rotateY(180deg);
}

.card-back {
    /* Novo verso da carta: mais escuro e elegante */
    background: #1e1e1e;
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: clamp(30px, 6vw, 45px);
    color: var(--primary-color);
    text-shadow: 0 0 8px var(--primary-color);
    /* Animação de pulso para o ícone */
    animation: pulse 2.5s infinite ease-in-out;
}

/* Estilo de Botão de Jogo (Game Button) */
.game-button {
    margin-top: 25px;
    padding: 15px 30px;
    font-size: 1.1rem;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    cursor: pointer;
    border: none;
    border-radius: 8px;
    background-color: var(--primary-color);
    border-bottom: 4px solid var(--primary-dark); /* Sombra 3D */
    color: #fff;
    transition: background-color 0.3s, transform 0.2s, box-shadow 0.3s;
}

.game-button:hover {
    background-color: var(--secondary-color);
}

.game-button:active {
    transform: translateY(2px); /* Efeito de pressionar */
    border-bottom-width: 2px;
}

/* Aplicando o estilo de botão de jogo */
.reset-button, .hero-button {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    cursor: pointer;
    border: none;
    border-radius: 8px;
    background-color: var(--primary-color);
    color: #fff;
    border-bottom: 4px solid var(--primary-dark); /* Sombra 3D */
    transition: background-color 0.3s, transform 0.2s, box-shadow 0.3s;
}

.reset-button {
    margin-top: 25px;
    padding: 12px 25px;
    font-size: 16px;
}

.hero-button {
    padding: 15px 30px;
    font-size: 1.1rem;
}

.hero-button:hover {
    background-color: var(--secondary-color);
}

.reset-button:hover {
    background-color: var(--secondary-color);
}

.reset-button:active, .hero-button:active {
    transform: translateY(2px); /* Efeito de pressionar */
    border-bottom-width: 2px;
}

.game-controls {
    display: flex;
    gap: 15px;
    margin-top: 25px;
}

/* Estilos para a camada de sobreposição dos modais */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: #2c2c2c;
    padding: 30px 40px;
    border-radius: 15px;
    text-align: center;
    color: #e0e0e0;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 5px 25px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.modal-content h2 {
    color: #fff;
    margin-top: 0;
    text-shadow: 0 0 8px var(--primary-color);
}

#pause-overlay .modal-content h2 {
    font-family: 'Bungee', cursive;
    text-shadow: 3px 3px 0px var(--secondary-color);
}

.unpause-text {
    margin-top: 1rem;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.7);
}

#pause-overlay {
    cursor: pointer;
}

#new-record-message {
    color: #ffd700; /* Dourado para o novo recorde */
    font-weight: 600;
}

.modal-content button {
    margin-top: 20px;
    padding: 10px 20px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    border-radius: 8px;
    background-color: var(--primary-color);
    color: white;
    transition: background-color 0.3s, transform 0.2s;
}

.modal-content button:hover {
    background-color: var(--secondary-color);
    transform: scale(1.05);
}

/* Media Queries para Responsividade */
@media (max-width: 600px) {
    body {
        align-items: flex-start;
        padding: 10px;
    }
    .game-container {
        padding: 15px 10px;
    }
    .game-board {
        gap: 10px;
    }
    .difficulty-selector {
        flex-wrap: wrap;
    }
}

/* Estilos da Mascote */
#mascot-container {
    position: fixed;
    bottom: 15px;
    left: 15px;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#mascot-character {
    width: 200px; 
    cursor: pointer;
    transition: transform 0.3s ease;
}

#mascot-character img {
    width: 100%;
    /* Efeito de sombra que funciona em imagens com transparência */
    filter: drop-shadow(0 4px 8px var(--primary-color));
}

#mascot-character:hover {
    transform: scale(1.05) translateY(-5px);
}

#mascot-speech-bubble {
    position: absolute;
    bottom: 175px; /* Posição ajustada para o novo tamanho */
    left: 0;
    width: 240px;
    padding: 15px;
    background: linear-gradient(145deg, #ffffff, #f0f0f0);
    color: #333;
    border-radius: 15px;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    opacity: 0;
    transform: translateY(10px) scale(0.9);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none; /* Para não interferir com cliques */
}

#mascot-speech-bubble.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

#mascot-speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 30px; /* Move a seta para a esquerda */
    border-width: 10px;
    border-style: solid;
    border-color: #f0f0f0 transparent transparent transparent;
}
