.game-container {
    text-align: center;
    padding: 40px 20px;
    max-width: 800px;
    margin: 0 auto;
}

.game-header {
    margin-bottom: 30px;
}

.game-header h1 {
    color: #2C2C2C;
    font-weight: 700;
    font-size: 32px;
    margin-bottom: 30px;
}

/* 난이도 및 모드 선택 - 메인 페이지 버튼 스타일 참고 */
.difficulty-selection, .mode-selection {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px;
}

.btn-diff, .btn-mode {
    background-color: white;
    border: 2px solid #E0E0E0;
    color: #3C3744;
    padding: 8px 24px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 90px;
}

/* 활성화 상태 - 메인 페이지의 강조색 (#B4C5E4) 반영 */
.btn-diff.active, .btn-mode.active {
    background-color: #B4C5E4;
    border-color: #B4C5E4;
    color: #3C3744;
    box-shadow: 0 2px 8px rgba(180, 197, 228, 0.4);
}

.btn-diff:hover, .btn-mode:hover {
    background-color: #f8f9fa;
    border-color: #ccc;
}

.btn-diff.active:hover, .btn-mode.active:hover {
    background-color: #A0B3D8;
}

/* 시작 버튼 - 메인 페이지의 검색창 배경색 (#3C3744) 활용 */
.btn-start {
    background-color: #3C3744;
    color: white;
    border: none;
    padding: 14px 45px;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 15px;
    box-shadow: 0 4px 12px rgba(60, 55, 68, 0.15);
}

.btn-start:hover {
    background-color: #4A4453;
    transform: translateY(-1px);
}

.btn-start:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.game-stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin: 25px 0;
    font-size: 1rem;
    font-weight: 600;
    color: #3C3744;
    background: white;
    display: inline-flex;
    padding: 12px 35px;
    border-radius: 8px;
    border: 2px solid #3C3744;
}

.stat-item span {
    color: #B4C5E4;
    font-size: 1.2rem;
    margin-left: 5px;
}

.game-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    background: #fff;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.06);
    max-width: 500px;
    margin: 20px auto;
    border: 1px solid #E0E0E0;
}

.game-board.mode-30 {
    grid-template-columns: repeat(6, 1fr);
    max-width: 750px;
}

.game-board.mode-20 {
    grid-template-columns: repeat(5, 1fr);
    max-width: 650px;
}

.card {
    aspect-ratio: 1 / 1;
    position: relative;
    cursor: pointer;
    transform-style: preserve-3d;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.card-face {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
    box-sizing: border-box;
}

.card-front {
    background-color: #3C3744;
    color: #B4C5E4;
    font-size: 1.8rem;
    font-weight: 800;
}

.card-back {
    background-color: #fff;
    transform: rotateY(180deg);
    border: 1px solid #EEE;
}

.card-back img {
    width: 85%;
    height: 85%;
    object-fit: contain;
}

.card.matched .card-back {
    background-color: #FBFFF1;
    border: 2px solid #B4C5E4;
}

/* 이용 가이드 스타일 */
.game-guide {
    max-width: 800px;
    margin: 60px auto 20px;
    background: white;
    border-radius: 12px;
    padding: 30px;
    text-align: left;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    border: 1px solid #E0E0E0;
}

.guide-title {
    font-size: 20px;
    font-weight: 700;
    color: #3C3744;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #B4C5E4;
    display: flex;
    align-items: center;
    gap: 10px;
}

.guide-content {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 25px;
}

.guide-subtitle {
    font-weight: 700;
    color: #3C3744;
    margin-bottom: 8px;
    font-size: 16px;
}

.guide-item p {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
    margin-bottom: 5px;
}

.guide-item strong {
    color: #3C3744;
}

/* ================================================
   모바일 및 6.1인치 최적화
   ================================================ */

@media (max-width: 768px) {
    .game-container { padding: 20px 10px !important; }
    .game-header h1 { font-size: 22px !important; margin-bottom: 20px !important; }

    /* 난이도/카드수 버튼 최적화 */
    .difficulty-selection, .mode-selection { gap: 5px !important; }
    .btn-diff, .btn-mode { 
        padding: 8px 12px !important; 
        font-size: 13px !important; 
        min-width: 60px !important;
        border-radius: 12px !important;
    }

    /* 통계 및 시작 버튼 가로 배치 조정 */
    .game-header > div:last-of-type {
        flex-direction: column !important;
        width: 100%;
    }
    .game-stats { 
        width: 100% !important; 
        padding: 10px !important; 
        font-size: 14px !important;
        justify-content: center !important;
    }
    .btn-start { width: 100% !important; margin-top: 10px !important; }

    /* ★ 게임 보드 6.1인치 최적화 */
    .game-board {
        padding: 10px !important;
        gap: 8px !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    /* 6.1인치에서는 무조건 4열로 고정하여 카드 크기 확보 */
    .game-board, .game-board.mode-20, .game-board.mode-30 {
        grid-template-columns: repeat(4, 1fr) !important;
    }

    .card-front { font-size: 1.4rem !important; }
    
    /* 이용 가이드 텍스트 축소 */
    .guide-card { padding: 15px !important; }
    .guide-card h4 { font-size: 15px !important; }
    .guide-card ul li { font-size: 12px !important; }

    /* 모바일 호버 효과 제거 */
    .btn-diff:hover, .btn-mode:hover { background-color: white !important; border-color: #E0E0E0 !important; }
    .btn-diff.active:hover, .btn-mode.active:hover { background-color: #B4C5E4 !important; }
    .btn-start:hover { transform: none !important; }
}

@media (max-width: 600px) {
    .game-board.mode-30, .game-board.mode-20 {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
        padding: 10px;
    }
}
