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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    max-width: 800px;
    width: 100%;
}

header {
    text-align: center;
    margin-bottom: 30px;
}

h1 {
    font-size: 2.5em;
    color: #333;
    margin-bottom: 10px;
    font-weight: 700;
}

.subtitle {
    font-size: 1.2em;
    color: #666;
}

.game-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}

.stats {
    display: flex;
    gap: 20px;
}

.stat-item {
    font-size: 1.1em;
    color: #555;
    font-weight: 500;
}

.stat-item span:last-child {
    color: #667eea;
    font-weight: 700;
}

.buttons {
    display: flex;
    gap: 15px;
    align-items: center;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a67d8;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.difficulty-select,
.language-select {
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.difficulty-select:hover,
.language-select:hover {
    border-color: #667eea;
}

.game-board {
    display: grid;
    gap: 15px;
    margin: 0 auto;
    perspective: 1000px;
}

.game-board.easy {
    max-width: 400px;
}

.game-board.medium {
    max-width: 600px;
}

.game-board.hard {
    max-width: 600px;
}

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

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

.card.matched {
    animation: matchAnimation 0.6s ease-out;
}

@keyframes matchAnimation {
    0% { transform: scale(1) rotateY(180deg); }
    50% { transform: scale(1.1) rotateY(180deg); }
    100% { transform: scale(1) rotateY(180deg); }
}

.card-front,
.card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5em;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

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

.card-back {
    background: white;
    transform: rotateY(180deg);
    border: 2px solid #f0f0f0;
}

.card:hover .card-front {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.card.matched .card-back {
    background: #e8f5e9;
    border-color: #4caf50;
}

.game-complete {
    text-align: center;
    animation: fadeIn 0.5s ease-out;
}

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

.game-complete h2 {
    font-size: 2.5em;
    color: #4caf50;
    margin-bottom: 20px;
}

.complete-message {
    font-size: 1.2em;
    color: #555;
    margin-bottom: 30px;
    line-height: 1.6;
}

.hidden {
    display: none;
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
    .container {
        padding: 20px;
    }
    
    h1 {
        font-size: 2em;
    }
    
    .game-controls {
        justify-content: center;
    }
    
    .stats {
        order: 2;
        width: 100%;
        justify-content: center;
    }
    
    .buttons {
        order: 1;
        width: 100%;
        justify-content: center;
    }
    
    .game-board {
        gap: 10px;
    }
    
    .card-front,
    .card-back {
        font-size: 2em;
    }
}

@media (max-width: 480px) {
    .game-board.hard {
        gap: 8px;
    }
    
    .card-front,
    .card-back {
        font-size: 1.5em;
    }
    
    .buttons {
        flex-direction: column;
        width: 100%;
    }
    
    .btn,
    .difficulty-select,
    .language-select {
        width: 100%;
    }
}