/* 메모리 게임 스타일 */

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

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

.container {
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    text-align: center;
}

/* 뒤로가기 버튼 */
.back-button {
    position: absolute;
    top: 20px;
    left: 20px;
}

.back-link {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 25px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
    display: inline-block;
}

.back-link:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* 게임 헤더 */
.game-header {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(15px);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.game-header h1 {
    color: white;
    font-size: 2rem;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.game-stats {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.stat {
    background: rgba(255, 255, 255, 0.1);
    padding: 10px 20px;
    border-radius: 10px;
    text-align: center;
}

.stat-label {
    display: block;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    color: white;
    font-size: 1.2rem;
    font-weight: bold;
}

/* 난이도 선택 */
.difficulty-selector {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(15px);
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.difficulty-selector h2 {
    color: white;
    font-size: 1.5rem;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.difficulty-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.difficulty-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 15px;
    padding: 20px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
    text-align: center;
    touch-action: manipulation;
}

.difficulty-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.diff-icon {
    display: block;
    font-size: 2rem;
    margin-bottom: 10px;
}

.diff-name {
    display: block;
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 5px;
}

.diff-desc {
    display: block;
    font-size: 0.9rem;
    opacity: 0.8;
}

/* 게임 보드 */
.game-board {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(15px);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.memory-grid {
    display: grid;
    gap: 10px;
    justify-content: center;
    max-width: 100%;
    margin: 0 auto;
}

.memory-grid.easy {
    grid-template-columns: repeat(4, 80px);
}

.memory-grid.medium {
    grid-template-columns: repeat(5, 70px);
}

.memory-grid.hard {
    grid-template-columns: repeat(6, 60px);
}

.memory-card {
    aspect-ratio: 1;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    position: relative;
    transform-style: preserve-3d;
}

.memory-card:hover {
    transform: scale(1.05);
}

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

.memory-card.matched {
    background: linear-gradient(45deg, #00b894, #00cec9);
    color: white;
    cursor: default;
}

.memory-card.disabled {
    pointer-events: none;
}

.memory-card:not(.flipped):not(.matched) {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
}

.memory-card:not(.flipped):not(.matched)::after {
    content: '❓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* 게임 컨트롤 */
.game-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.control-btn {
    background: linear-gradient(45deg, #fd79a8, #e84393);
    border: none;
    border-radius: 25px;
    padding: 12px 25px;
    color: white;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    touch-action: manipulation;
}

.control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(232, 67, 147, 0.4);
}

.control-btn:nth-child(2) {
    background: linear-gradient(45deg, #fdcb6e, #e17055);
}

.control-btn:nth-child(3) {
    background: linear-gradient(45deg, #00b894, #00cec9);
}

/* 모달 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(15px);
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.modal-content h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.8rem;
}

.final-stats {
    margin-bottom: 20px;
    color: #555;
}

.final-stats p {
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.modal-btn {
    background: linear-gradient(45deg, #667eea, #764ba2);
    border: none;
    border-radius: 25px;
    padding: 12px 25px;
    color: white;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    touch-action: manipulation;
}

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

.modal-btn:first-child {
    background: linear-gradient(45deg, #00b894, #00cec9);
}

/* 애니메이션 */
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes shimmer {
    0% { background-position: -200px 0; }
    100% { background-position: 200px 0; }
}

@keyframes flipCard {
    0% { transform: rotateY(0deg); }
    50% { transform: rotateY(90deg); }
    100% { transform: rotateY(180deg); }
}

@keyframes unflipCard {
    0% { transform: rotateY(180deg); }
    50% { transform: rotateY(90deg); }
    100% { transform: rotateY(0deg); }
}

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

/* 반응형 디자인 */
@media (max-width: 768px) {
    .game-header h1 {
        font-size: 1.5rem;
    }
    
    .game-stats {
        gap: 15px;
    }
    
    .stat {
        padding: 8px 15px;
    }
    
    .difficulty-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .difficulty-btn {
        width: 100%;
        max-width: 250px;
    }
    
    .memory-grid.easy {
        grid-template-columns: repeat(4, 70px);
        gap: 8px;
    }
    
    .memory-grid.medium {
        grid-template-columns: repeat(5, 60px);
        gap: 8px;
    }
    
    .memory-grid.hard {
        grid-template-columns: repeat(6, 50px);
        gap: 6px;
    }
    
    .memory-card {
        font-size: 1.5rem;
    }
    
    .game-controls {
        flex-direction: column;
        align-items: center;
    }
    
    .control-btn {
        width: 100%;
        max-width: 200px;
    }
}

@media (max-width: 480px) {
    .back-button {
        position: relative;
        top: 0;
        left: 0;
        margin-bottom: 20px;
    }
    
    .container {
        padding-top: 0;
    }
    
    .game-header {
        padding: 15px;
    }
    
    .difficulty-selector {
        padding: 20px 15px;
    }
    
    .memory-grid.easy {
        grid-template-columns: repeat(4, 60px);
    }
    
    .memory-grid.medium {
        grid-template-columns: repeat(5, 50px);
    }
    
    .memory-grid.hard {
        grid-template-columns: repeat(6, 45px);
    }
    
    .memory-card {
        font-size: 1.2rem;
    }
    
    .modal-content {
        padding: 20px;
        max-width: 350px;
    }
    
    .modal-buttons {
        flex-direction: column;
    }
    
    .modal-btn {
        width: 100%;
    }
}