
/* =================================================================
   VITÓRIAMEMO - ESTILOS CSS
   Jogo da Memória Infantil
   ================================================================= */

/* IMPORTAÇÃO DE FONTES */
/* Usamos Google Fonts para fontes amigáveis e arredondadas */
@import url('https://fonts.googleapis.com/css2?family=Fredoka+One:wght@400&family=Poppins:wght@300;400;600;700&display=swap');

/* RESET E CONFIGURAÇÕES BÁSICAS */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    overflow-x: hidden;
}

/* CONTAINER PRINCIPAL */
.container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
}

/* =================================================================
   SISTEMA DE TELAS
   ================================================================= */

.screen {
    display: none;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    animation: fadeIn 0.5s ease-in-out;
}

.screen.active {
    display: block;
}

/* Animação de entrada das telas */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =================================================================
   TELA DE CONFIGURAÇÃO INICIAL
   ================================================================= */

.setup-content {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 25px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    text-align: center;
    backdrop-filter: blur(10px);
}

/* Título principal */
.game-title {
    font-family: 'Fredoka One', cursive;
    font-size: 3.5em;
    color: #4a5568;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    animation: bounce 2s infinite;
}

.game-subtitle {
    font-size: 1.3em;
    color: #718096;
    margin-bottom: 40px;
    font-weight: 300;
}

/* Animação de bounce para o título */
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

/* CONFIGURAÇÃO DOS JOGADORES */
.players-setup {
    display: flex;
    gap: 30px;
    margin-bottom: 40px;
    justify-content: center;
}

.player-input {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.player-input label {
    font-size: 1.2em;
    font-weight: 600;
    color: #4a5568;
}

.player-input input {
    padding: 15px 20px;
    border: 3px solid #e2e8f0;
    border-radius: 15px;
    font-size: 1.1em;
    font-family: 'Poppins', sans-serif;
    transition: all 0.3s ease;
    width: 200px;
}

.player-input input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transform: scale(1.05);
}

/* SELEÇÃO DE TEMAS */
.theme-selection h3 {
    font-size: 1.5em;
    color: #4a5568;
    margin-bottom: 25px;
    font-weight: 600;
}

.theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.theme-btn {
    background: linear-gradient(145deg, #ffffff, #f7fafc);
    border: 3px solid #e2e8f0;
    border-radius: 20px;
    padding: 20px 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Poppins', sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.theme-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    border-color: #667eea;
}

.theme-btn.selected {
    background: linear-gradient(145deg, #667eea, #764ba2);
    color: white;
    border-color: #667eea;
    transform: scale(1.05);
}

.theme-icon {
    font-size: 2.5em;
    margin-bottom: 5px;
}

.theme-btn span {
    font-size: 0.9em;
    font-weight: 600;
    text-align: center;
    line-height: 1.2;
}

/* BOTÃO INICIAR JOGO */
.start-btn {
    background: linear-gradient(145deg, #48bb78, #38a169);
    color: white;
    border: none;
    padding: 20px 60px;
    font-size: 1.4em;
    font-weight: 700;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Poppins', sans-serif;
    box-shadow: 0 10px 25px rgba(72, 187, 120, 0.3);
}

.start-btn:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 15px 35px rgba(72, 187, 120, 0.4);
}

.start-btn:disabled {
    background: #cbd5e0;
    cursor: not-allowed;
    box-shadow: none;
}

/* =================================================================
   TELA DO JOGO
   ================================================================= */

/* CABEÇALHO DO JOGO */
.game-header {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 30px;
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: 20px;
    align-items: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

/* INDICADOR DE NÍVEL */
.level-indicator {
    text-align: center;
}

.level-indicator span {
    font-size: 1.3em;
    font-weight: 700;
    color: #4a5568;
    display: block;
    margin-bottom: 10px;
}

.level-progress {
    background: #e2e8f0;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
}

#level-progress-bar {
    background: linear-gradient(90deg, #48bb78, #38a169);
    height: 100%;
    width: 33.33%;
    transition: width 0.5s ease;
    border-radius: 4px;
}

/* PLACAR DOS JOGADORES */
.scoreboard {
    display: flex;
    justify-content: center;
    gap: 40px;
}

.player-score {
    text-align: center;
    padding: 15px 25px;
    border-radius: 15px;
    transition: all 0.3s ease;
    border: 3px solid transparent;
}

.player-score.active {
    background: linear-gradient(145deg, #667eea, #764ba2);
    color: white;
    transform: scale(1.1);
    border-color: #667eea;
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.3);
}

.player-name {
    display: block;
    font-weight: 600;
    font-size: 1.1em;
    margin-bottom: 5px;
}

.score {
    display: block;
    font-size: 2em;
    font-weight: 700;
    font-family: 'Fredoka One', cursive;
}

/* INDICADOR DE TURNO */
.turn-indicator {
    text-align: center;
}

#current-turn {
    font-size: 1.2em;
    font-weight: 600;
    color: #4a5568;
    background: linear-gradient(145deg, #ffd89b, #19547b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* TABULEIRO DO JOGO */
.game-board {
    display: grid;
    gap: 15px;
    justify-content: center;
    margin-bottom: 30px;
    padding: 30px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 25px;
    backdrop-filter: blur(10px);
}

/* Configurações de grid para diferentes níveis */
.game-board.level-1 {
    grid-template-columns: repeat(4, 1fr);
    max-width: 600px;
    margin: 0 auto 30px;
}

.game-board.level-2 {
    grid-template-columns: repeat(5, 1fr);
    max-width: 750px;
    margin: 0 auto 30px;
}

.game-board.level-3 {
    grid-template-columns: repeat(6, 1fr);
    max-width: 900px;
    margin: 0 auto 30px;
}

/* CARTAS DO JOGO */
.card {
    aspect-ratio: 1;
    background: linear-gradient(145deg, #ffffff, #f7fafc);
    border: 3px solid #e2e8f0;
    border-radius: 20px;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3em;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

/* Estados das cartas */
.card.flipped {
    background: linear-gradient(145deg, #667eea, #764ba2);
    color: white;
    border-color: #667eea;
    transform: rotateY(180deg);
}

.card.matched {
    background: linear-gradient(145deg, #48bb78, #38a169);
    color: white;
    border-color: #48bb78;
    animation: matchPulse 0.6s ease;
}

.card.disabled {
    pointer-events: none;
    opacity: 0.7;
}

/* Animação para cartas que fazem par */
@keyframes matchPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Verso das cartas (estado inicial) */
.card-back {
    position: absolute;
    inset: 0;
    background: linear-gradient(145deg, #a78bfa, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2em;
    border-radius: 17px;
    transition: all 0.3s ease;
}

.card.flipped .card-back {
    transform: rotateY(180deg);
    opacity: 0;
}

/* Frente das cartas (conteúdo) */
.card-front {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: rotateY(-180deg);
    transition: all 0.3s ease;
    border-radius: 17px;
}

.card.flipped .card-front {
    opacity: 1;
    transform: rotateY(0deg);
}

/* Imagens nas cartas */
.card-front img {
    max-width: 80%;
    max-height: 80%;
    object-fit: contain;
    border-radius: 10px;
}

/* BOTÃO VOLTAR */
.back-btn {
    background: linear-gradient(145deg, #ed8936, #dd6b20);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.1em;
    font-weight: 600;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Poppins', sans-serif;
    display: block;
    margin: 0 auto;
}

.back-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(237, 137, 54, 0.3);
}

/* =================================================================
   TELA DE VITÓRIA
   ================================================================= */

.victory-content {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 25px;
    padding: 50px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    position: relative;
    z-index: 10;
}

.victory-title {
    font-family: 'Fredoka One', cursive;
    font-size: 3em;
    color: #4a5568;
    margin-bottom: 30px;
    animation: victoryBounce 1s ease infinite alternate;
}

@keyframes victoryBounce {
    from { transform: scale(1); }
    to { transform: scale(1.05); }
}

.final-score {
    margin: 30px 0;
}

.final-score h3 {
    font-size: 1.5em;
    color: #4a5568;
    margin-bottom: 20px;
    font-weight: 600;
}

#final-scoreboard {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 30px;
}

.final-player-score {
    background: linear-gradient(145deg, #667eea, #764ba2);
    color: white;
    padding: 20px;
    border-radius: 15px;
    min-width: 150px;
}

.final-player-score.winner {
    background: linear-gradient(145deg, #48bb78, #38a169);
    transform: scale(1.1);
    box-shadow: 0 10px 30px rgba(72, 187, 120, 0.3);
}

.play-again-btn {
    background: linear-gradient(145deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 20px 50px;
    font-size: 1.3em;
    font-weight: 700;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Poppins', sans-serif;
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
}

.play-again-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 35px rgba(102, 126, 234, 0.4);
}

/* =================================================================
   ANIMAÇÕES DE CELEBRAÇÃO
   ================================================================= */

#celebration-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

/* Confetes */
.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    animation: confettiFall 3s linear infinite;
}

@keyframes confettiFall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Balões */
.balloon {
    position: absolute;
    bottom: -50px;
    width: 30px;
    height: 40px;
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    animation: balloonRise 4s ease-out infinite;
}

@keyframes balloonRise {
    0% {
        transform: translateY(0) rotate(-5deg);
        opacity: 1;
    }
    100% {
        transform: translateY(-100vh) rotate(5deg);
        opacity: 0;
    }
}

/* =================================================================
   TRANSIÇÃO ENTRE NÍVEIS
   ================================================================= */

.level-transition {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.level-transition.hidden {
    display: none;
}

.transition-content {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 25px;
    padding: 50px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.transition-content h2 {
    font-family: 'Fredoka One', cursive;
    font-size: 2.5em;
    color: #4a5568;
    margin-bottom: 20px;
}

.transition-content p {
    font-size: 1.2em;
    color: #718096;
    margin-bottom: 30px;
}

/* Spinner de carregamento */
.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #e2e8f0;
    border-top: 5px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* =================================================================
   RESPONSIVIDADE
   ================================================================= */

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .setup-content {
        padding: 30px 20px;
    }
    
    .game-title {
        font-size: 2.5em;
    }
    
    .players-setup {
        flex-direction: column;
        gap: 20px;
    }
    
    .player-input input {
        width: 100%;
    }
    
    .theme-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .game-header {
        grid-template-columns: 1fr;
        gap: 15px;
        text-align: center;
    }
    
    .scoreboard {
        gap: 20px;
    }
    
    .game-board {
        gap: 10px;
        padding: 20px;
    }
    
    .game-board.level-1 {
        max-width: 400px;
    }
    
    .game-board.level-2 {
        max-width: 500px;
    }
    
    .game-board.level-3 {
        max-width: 600px;
    }
    
    .card {
        font-size: 2em;
    }
    
    .victory-content {
        padding: 30px 20px;
    }
    
    .victory-title {
        font-size: 2em;
    }
    
    #final-scoreboard {
        flex-direction: column;
        gap: 20px;
    }
}

@media (max-width: 480px) {
    .game-title {
        font-size: 2em;
    }
    
    .theme-grid {
        grid-template-columns: 1fr;
    }
    
    .card {
        font-size: 1.5em;
    }
}
