* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: linear-gradient(135deg, #ffcc70, #ff9a8b);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    max-width: 800px;
    width: 100%;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    position: relative;
}

/* Telas */
.screen {
    display: none;
    min-height: 600px;
}

.screen.active {
    display: block;
}

/* Tela Inicial */
#start-screen {
    padding: 40px;
    text-align: center;
}

.start-content h1 {
    font-size: 3rem;
    color: #ff7eb3;
    margin-bottom: 50px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.game-selection {
    display: flex;
    flex-direction: column;
    gap: 25px;
    align-items: center;
}

.game-btn {
    background: linear-gradient(135deg, #ff7eb3, #ff65a3);
    border: none;
    border-radius: 50px;
    padding: 20px 40px;
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
    width: 300px;
}

.game-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

/* Header comum */
header {
    background: linear-gradient(135deg, #ff7eb3, #ff65a3);
    color: white;
    padding: 20px;
    position: relative;
}

.back-btn {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(255, 255, 255, 0.2);
    border: 2px solid white;
    color: white;
    padding: 8px 15px;
    font-size: 0.9rem;
}

.back-btn:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

h1 {
    font-size: 2.2rem;
    margin-bottom: 15px;
    text-align: center;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.moves, .timer, .status, .score, .high-score {
    font-size: 1.2rem;
    font-weight: bold;
}

button {
    background-color: #ffcc00;
    border: none;
    border-radius: 50px;
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: bold;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

button:hover {
    background-color: #ffaa00;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

main {
    padding: 30px;
}

/* Jogo da Memória */
.game-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    perspective: 1000px;
}

.card {
    height: 120px;
    background-color: #ff7eb3;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 3rem;
    cursor: pointer;
    transform-style: preserve-3d;
    transition: transform 0.5s;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

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

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.card-front {
    background-color: #ffcc00;
    transform: rotateY(180deg);
}

.card-back {
    background-color: #ff7eb3;
    background-image: linear-gradient(135deg, #ff7eb3 0%, #ff65a3 100%);
}

.card.matched .card-front {
    background-color: #7bed9f;
}

/* Jogo da Velha */
.tic-tac-toe-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

.tic-tac-toe-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    background-color: #ff7eb3;
    padding: 10px;
    border-radius: 15px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.ttt-cell {
    width: 100px;
    height: 100px;
    background-color: white;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 3rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.ttt-cell:hover {
    background-color: #f8f8f8;
    transform: scale(1.05);
}

.ttt-cell.taken {
    cursor: not-allowed;
}

.ttt-cell.taken:hover {
    transform: none;
}

.players-info {
    display: flex;
    gap: 40px;
    justify-content: center;
}

.player {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 15px 25px;
    background: linear-gradient(135deg, #ffcc70, #ff9a8b);
    border-radius: 15px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.player-symbol {
    font-size: 2rem;
}

/* Jogo da Cobrinha */
.snake-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

.snake-game-board {
    width: 400px;
    height: 400px;
    background-color: #2c3e50;
    border: 3px solid #34495e;
    border-radius: 10px;
    display: grid;
    grid-template-columns: repeat(20, 1fr);
    grid-template-rows: repeat(20, 1fr);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.snake-cell {
    width: 100%;
    height: 100%;
    border: 1px solid rgba(52, 73, 94, 0.3);
}

.snake-head {
    background: linear-gradient(135deg, #7bed9f, #2ed573);
    border-radius: 4px;
    z-index: 2;
}

.snake-body {
    background: linear-gradient(135deg, #70a1ff, #1e90ff);
    border-radius: 3px;
    z-index: 1;
}

.snake-food {
    background: linear-gradient(135deg, #ff6b81, #ff4757);
    border-radius: 50%;
    animation: pulse 1s infinite;
    z-index: 1;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.snake-controls {
    display: flex;
    gap: 40px;
    align-items: flex-start;
}

.controls-info {
    background: linear-gradient(135deg, #ffcc70, #ff9a8b);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    min-width: 200px;
}

.controls-info h3 {
    margin-bottom: 10px;
    color: #2c3e50;
}

.controls-info p {
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: #2c3e50;
}

.mobile-controls {
    display: none;
    flex-direction: column;
    gap: 10px;
}

.control-row {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.control-btn {
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #ff7eb3, #ff65a3);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

/* Mensagens de vitória */
.win-message {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    text-align: center;
    z-index: 100;
}

.win-message h2 {
    font-size: 3rem;
    margin-bottom: 20px;
    color: #ffcc00;
}

.win-message p {
    font-size: 1.5rem;
    margin-bottom: 30px;
}

.hidden {
    display: none;
}

/* Responsividade */
@media (max-width: 768px) {
    .game-board {
        grid-template-columns: repeat(3, 1fr);
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    .card {
        height: 100px;
        font-size: 2.5rem;
    }
    
    .ttt-cell {
        width: 80px;
        height: 80px;
        font-size: 2.5rem;
    }
    
    .game-info {
        flex-direction: column;
        gap: 15px;
    }
    
    .back-btn {
        position: relative;
        left: 0;
        top: 0;
        transform: none;
        margin-bottom: 10px;
    }
    
    .snake-game-board {
        width: 350px;
        height: 350px;
    }
    
    .snake-controls {
        flex-direction: column;
        gap: 20px;
        align-items: center;
    }
    
    .mobile-controls {
        display: flex;
    }
}

@media (max-width: 480px) {
    .game-board {
        grid-template-columns: repeat(2, 1fr);
    }
    
    h1 {
        font-size: 1.6rem;
    }
    
    .card {
        height: 80px;
        font-size: 2rem;
    }
    
    .ttt-cell {
        width: 70px;
        height: 70px;
        font-size: 2rem;
    }
    
    .players-info {
        flex-direction: column;
        gap: 15px;
    }
    
    .start-content h1 {
        font-size: 2.2rem;
    }
    
    .game-btn {
        width: 250px;
        font-size: 1.2rem;
        padding: 15px 30px;
    }
    
    .snake-game-board {
        width: 300px;
        height: 300px;
    }
    
    .controls-info {
        min-width: 150px;
        padding: 15px;
    }
    
    .controls-info p {
        font-size: 0.8rem;
    }
}