* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #667eea;
    --secondary: #764ba2;
    --success: #48bb78;
    --warning: #f6ad55;
    --danger: #f56565;
    --dark: #2d3748;
    --light: #f7fafc;
    --gray: #e2e8f0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    min-height: 100vh;
    color: var(--dark);
}

#app {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* Menu Principal */
.menu-container {
    background: white;
    border-radius: 20px;
    padding: 40px 30px;
    max-width: 800px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.menu-header {
    text-align: center;
    margin-bottom: 40px;
}

.menu-title {
    font-size: 2.5rem;
    margin-bottom: 10px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.menu-subtitle {
    color: #718096;
    font-size: 1rem;
}

.score-display {
    background: var(--light);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 30px;
    text-align: center;
    border: 2px solid var(--gray);
}

.score-label {
    color: #718096;
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.score-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary);
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.game-button {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    padding: 20px;
    border-radius: 15px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.game-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.game-button:active {
    transform: translateY(-1px);
}

.game-button-icon {
    display: block;
    font-size: 2rem;
    margin-bottom: 5px;
}

.reset-button {
    width: 100%;
    background: var(--danger);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.reset-button:hover {
    background: #e53e3e;
}

/* Game Screen */
.game-container {
    background: white;
    border-radius: 20px;
    padding: 30px;
    max-width: 600px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.5s ease-out;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.game-title {
    font-size: 1.8rem;
    color: var(--dark);
}

.game-info {
    display: flex;
    gap: 15px;
    align-items: center;
}

.game-score {
    background: var(--light);
    padding: 8px 15px;
    border-radius: 8px;
    font-weight: 600;
    color: var(--primary);
}

.back-button {
    background: var(--gray);
    border: none;
    padding: 8px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.back-button:hover {
    background: #cbd5e0;
}

.game-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Memory Game */
.memory-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    width: 100%;
    max-width: 400px;
}

.memory-card {
    aspect-ratio: 1;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    border-radius: 10px;
    font-size: 2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.memory-card:hover:not(.flipped) {
    transform: scale(1.05);
}

.memory-card.flipped {
    background: var(--light);
    color: var(--dark);
    cursor: not-allowed;
}

/* 2048 Game */
.grid-2048 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    background: #bbada0;
    padding: 10px;
    border-radius: 10px;
    width: 100%;
    max-width: 300px;
}

.tile {
    background: #cdc1b4;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    min-height: 60px;
    color: #776e65;
    animation: pop 0.1s ease-in-out;
}

.tile.empty {
    background: #bbada0;
    color: transparent;
}

.tile.merged {
    animation: pop 0.2s ease-in-out;
}

@keyframes pop {
    0% {
        transform: scale(0.8);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

/* Sudoku */
.sudoku-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3px;
    background: #999;
    padding: 3px;
    width: fit-content;
    margin: 0 auto;
}

.sudoku-box {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    background: #fff;
    border: 1px solid #999;
}

.sudoku-cell {
    width: 40px;
    height: 40px;
    border: 1px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.1rem;
    cursor: pointer;
    background: white;
}

.sudoku-cell:hover {
    background: #f0f0f0;
}

.sudoku-cell.given {
    background: #e8e8e8;
    font-weight: 900;
    cursor: default;
}

.sudoku-cell.selected {
    background: #cce5ff;
}

.sudoku-cell.error {
    background: #ffcccc;
}

.sudoku-controls {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
    margin-top: 20px;
    max-width: 200px;
    margin-left: auto;
    margin-right: auto;
}

.num-button {
    padding: 8px;
    background: var(--light);
    border: 2px solid var(--primary);
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.num-button:hover {
    background: var(--primary);
    color: white;
}

.clear-button {
    grid-column: 1 / -1;
    padding: 8px;
    background: var(--danger);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

/* Message */
.message {
    text-align: center;
    padding: 20px;
    margin-top: 20px;
    border-radius: 8px;
    font-weight: 600;
}

.message.success {
    background: #c6f6d5;
    color: #22543d;
}

.message.error {
    background: #fed7d7;
    color: #742a2a;
}

.message.info {
    background: #bee3f8;
    color: #2c5282;
}

/* Responsive */
@media (max-width: 768px) {
    .menu-container {
        padding: 20px;
    }

    .menu-title {
        font-size: 2rem;
    }

    .games-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .game-container {
        padding: 20px;
    }

    .memory-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .sudoku-cell {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }

    .game-title {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .menu-container,
    .game-container {
        border-radius: 15px;
        padding: 15px;
    }

    .menu-title {
        font-size: 1.5rem;
    }

    .games-grid {
        grid-template-columns: 1fr;
    }

    .memory-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .sudoku-cell {
        width: 30px;
        height: 30px;
        font-size: 0.9rem;
    }
}