* {
    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;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    width: 100%;
    max-width: 1200px;
}

.screen {
    display: none;
    animation: fadeIn 0.5s ease-in;
}

.screen.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Login Screen */
.login-box {
    background: white;
    border-radius: 20px;
    padding: 60px 40px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    margin: 0 auto;
}

.login-box h1 {
    font-size: 3em;
    color: #667eea;
    margin-bottom: 10px;
}

.subtitle {
    color: #666;
    font-size: 1.2em;
    margin-bottom: 40px;
}

#username-input {
    width: 100%;
    padding: 15px 20px;
    font-size: 1.1em;
    border: 2px solid #ddd;
    border-radius: 10px;
    margin-bottom: 20px;
    transition: border-color 0.3s;
}

#username-input:focus {
    outline: none;
    border-color: #667eea;
}

.btn {
    padding: 15px 40px;
    font-size: 1.1em;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: bold;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

/* Difficulty Screen */
.difficulty-box {
    background: white;
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 800px;
    margin: 0 auto;
}

.difficulty-box h2 {
    font-size: 2.5em;
    color: #333;
    margin-bottom: 40px;
}

.difficulty-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.difficulty-btn {
    background: white;
    border: 3px solid #ddd;
    border-radius: 15px;
    padding: 30px 20px;
    cursor: pointer;
    transition: all 0.3s;
}

.difficulty-btn:hover {
    transform: translateY(-5px);
    border-color: #667eea;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
}

.difficulty-btn .emoji {
    font-size: 3em;
    display: block;
    margin-bottom: 10px;
}

.difficulty-btn h3 {
    color: #333;
    margin-bottom: 10px;
    font-size: 1.5em;
}

.difficulty-btn p {
    color: #666;
    font-size: 0.9em;
}

/* Game Screen */
.game-header {
    background: white;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.game-info {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}

.info-item {
    display: flex;
    flex-direction: column;
}

.info-item .label {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 5px;
}

.info-item .value {
    font-size: 1.5em;
    font-weight: bold;
    color: #667eea;
}

.game-board {
    display: grid;
    gap: 15px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    justify-content: center;
}

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

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

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

.card {
    width: 100%;
    aspect-ratio: 1;
    position: relative;
    cursor: pointer;
    transform-style: preserve-3d;
    transition: transform 0.6s;
}

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

.card.matched {
    opacity: 0.6;
    pointer-events: none;
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 3em;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.card-front {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: bold;
}

.card-back {
    background: white;
    transform: rotateY(180deg);
}

/* Victory Screen */
.victory-box {
    background: white;
    border-radius: 20px;
    padding: 60px 40px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    margin: 0 auto;
}

.victory-title {
    font-size: 3em;
    color: #667eea;
    margin-bottom: 20px;
}

.victory-message {
    font-size: 1.3em;
    color: #666;
    margin-bottom: 40px;
}

.victory-stats {
    display: flex;
    justify-content: center;
    gap: 60px;
    margin-bottom: 40px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-value {
    font-size: 3em;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 10px;
}

.stat-label {
    font-size: 1.1em;
    color: #666;
}

.victory-actions {
    display: flex;
    gap: 20px;
    justify-content: center;
}

/* Scores Screen */
.scores-box {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 800px;
    margin: 0 auto;
}

.scores-box h2 {
    font-size: 2.5em;
    color: #333;
    margin-bottom: 30px;
    text-align: center;
}

.scores-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    justify-content: center;
}

.tab-btn {
    padding: 10px 30px;
    border: 2px solid #ddd;
    background: white;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 1em;
}

.tab-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.tab-btn:hover:not(.active) {
    border-color: #667eea;
}

.scores-list {
    min-height: 300px;
    margin-bottom: 30px;
}

.score-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    margin-bottom: 10px;
    background: #f8f9fa;
    border-radius: 10px;
    transition: transform 0.3s;
}

.score-item:hover {
    transform: translateX(5px);
}

.score-item.top-3 {
    background: linear-gradient(135deg, #ffeaa7 0%, #fdcb6e 100%);
}

.score-rank {
    font-size: 1.5em;
    font-weight: bold;
    color: #667eea;
    min-width: 40px;
}

.score-player {
    flex: 1;
    font-size: 1.1em;
    font-weight: bold;
    color: #333;
}

.score-stats {
    display: flex;
    gap: 20px;
    color: #666;
}

.loading {
    text-align: center;
    color: #666;
    font-size: 1.2em;
    padding: 40px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .game-board.easy {
        grid-template-columns: repeat(4, 80px);
    }
    
    .game-board.medium {
        grid-template-columns: repeat(4, 70px);
    }
    
    .game-board.hard {
        grid-template-columns: repeat(6, 60px);
    }
    
    .card-face {
        font-size: 2em;
    }
    
    .game-info {
        gap: 15px;
    }
    
    .info-item .value {
        font-size: 1.2em;
    }
    
    .difficulty-options {
        grid-template-columns: 1fr;
    }
    
    .victory-stats {
        gap: 30px;
    }
}
