* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

h1, h2{
    text-align: center;
    color: white;
    margin-bottom: 20px;
    font-size: 2.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

h2 {
    font-size: 1.2rem;
    margin-top: -10px;
    margin-bottom: 30px;
}

p {
    font-size: 1rem;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 20px;
    text-align: center;
    color: white;

}

/* ===== MENU SCREEN ===== */
#menuScreen {
    max-width: 800px;
    margin: 0 auto;
}

.back-link {
    display: inline-block;
    color: white;
    text-decoration: none;
    margin-bottom: 30px;
    font-size: 1rem;
    opacity: 0.9;
    transition: opacity 0.3s;
}

.back-link:hover {
    opacity: 1;
}

.menu-container {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.menu-section {
    margin-bottom: 40px;
}

.menu-section h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.level-buttons, .theme-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.level-btn, .theme-btn {
    background: #f5f5f5;
    border: 3px solid transparent;
    border-radius: 15px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.level-btn:hover, .theme-btn:hover {
    background: #e8e8e8;
    transform: translateY(-3px);
}

.level-btn.selected, .theme-btn.selected {
    border-color: #667eea;
    background: #f0f4ff;
}

.level-icon {
    font-size: 2rem;
}

.level-name, .theme-name {
    font-weight: bold;
    color: #333;
    font-size: 1.25rem;
}

.level-desc {
    font-size: 0.9rem;
    color: #666;
}


.theme-preview img {
    height: 3rem;
    border-radius: 50%;
}

.start-btn {
    width: 100%;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 12px;
    padding: 18px;
    font-size: 1.3rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 20px;
}

.start-btn:hover:not(:disabled) {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.start-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* ===== GAME SCREEN ===== */
#gameScreen {
    max-width: 1400px;
    margin: 0 auto;
}

.game-layout {
    display: grid;
    grid-template-columns: 200px 1fr 200px;
    gap: 30px;
    align-items: start;
}

/* Left Panel */
.left-panel {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.control-btn {
    background: white;
    border: none;
    border-radius: 12px;
    padding: 15px 20px;
    font-size: 1rem;
    font-weight: bold;
    color: #667eea;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

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

.control-btn.secondary {
    background: #f5f5f5;
    color: #666;
}

/* Center - Game Board */
.game-board-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.game-board {
    display: grid;
    gap: 10px;
    padding: 30px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

.game-board.grid-4 {
    grid-template-columns: repeat(4, 100px);
}

.game-board.grid-6 {
    grid-template-columns: repeat(4, 100px);
}

.game-board.grid-8 {
    grid-template-columns: repeat(6, 100px);
}

.card {
    background-color: #ccc;
    width: 100px;
    height: 100px;
    font-size: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 10px;
    user-select: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, background-color 0.3s ease;
}


.card img {
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
    display: none;
    border-radius: 10px;
}

.card.flipped {
    background-color: white;
    transform: scale(1.05);
}

@keyframes matchAnimation {
    0% { transform: scale(1); background-color: #fff; }
    50% { transform: scale(1.2); background-color: #90ee90; }
    100% { transform: scale(1); background-color: #fff; }
}

.card.matched {
    animation: matchAnimation 0.5s ease;
}

.win-message {
    color: #fff;
    font-size: 1.5rem;
    font-weight: bold;
    margin-top: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

/* Right Panel */
.right-panel {
    display: flex;
    flex-direction: column;
}

.timer-box {
    background: white;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.timer-label {
    font-size: 1rem;
    color: #666;
    margin-bottom: 10px;
}

.timer-value {
    font-size: 2rem;
    font-weight: bold;
    color: #667eea;
}

/* Responsive */
@media (max-width: 1024px) {
    .game-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .left-panel, .right-panel {
        flex-direction: row;
        justify-content: center;
    }
    
    .timer-box {
        display: inline-block;
    }
}

@media (max-width: 768px) {
    h1 {
        font-size: 1.8rem;
    }
    
    .menu-container {
        padding: 20px;
    }
    
    .card {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }
    
    .game-board.grid-4,
    .game-board.grid-6,
    .game-board.grid-8 {
        grid-template-columns: repeat(4, 60px);
    }
}