/* style.css */
body {
    font-family: 'Noto Sans KR', sans-serif;
    display: flex;
    flex-direction: column; /* 헤더와 컨테이너를 수직 정렬 */
    align-items: center;
    min-height: 100vh;
    background-color: #f0f2f5; /* 부드러운 배경색 */
    margin: 0;
    padding: 20px;
    box-sizing: border-box;
    color: #333;
}

.game-wrapper {
    width: 100%;
    max-width: 800px; /* 게임 컨텐츠 최대 너비 */
}

.game-header {
    text-align: center;
    margin-bottom: 20px;
}

.game-header h1 {
    font-size: 2.5em;
    color: #2c3e50; /* 진한 파란색 계열 */
    font-weight: 700;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

.game-container {
    background-color: #ffffff;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
    text-align: center;
}

.controls-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px; /* 컨트롤 그룹 간 간격 */
    margin-bottom: 25px;
}

.controls {
    display: flex;
    gap: 15px; /* 내부 요소 간 간격 */
    align-items: center;
    justify-content: center;
    flex-wrap: wrap; /* 작은 화면에서 줄 바꿈 */
}

.controls label {
    font-size: 1em;
    font-weight: 500;
}

.controls select,
.action-button { /* 버튼 공통 스타일 */
    padding: 10px 18px;
    font-size: 1em;
    border-radius: 6px;
    border: 1px solid #d1d1d1;
    background-color: #fff;
    cursor: pointer;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
    font-family: 'Noto Sans KR', sans-serif;
}

.controls select:focus,
.action-button:focus {
    outline: none;
    border-color: #4a90e2; /* 포커스 시 테두리 색상 */
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.3);
}

.action-button {
    background-color: #4CAF50; /* 기본 버튼 색상 (녹색 계열) */
    color: white;
    border-color: #4CAF50;
    font-weight: 500;
}

.action-button:hover {
    background-color: #45a049;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.rankings-link-container .button-link { /* 순위 보기 링크를 버튼처럼 */
    text-decoration: none;
    display: inline-block;
    background-color: #3498db; /* 다른 색상으로 구분 (파란색 계열) */
    color: white;
    border-color: #3498db;
}

.rankings-link-container .button-link:hover {
    background-color: #2980b9;
}


.game-info {
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin-bottom: 25px;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: 500;
}

.game-info div span {
    font-weight: 700;
    color: #e74c3c; /* 정보 텍스트 강조색 */
}

#game-board-container {
    margin: 0 auto; /* 게임판 가운데 정렬 */
    padding: 5px; /* 게임판 주변 약간의 여백 */
    background-color: #c0c0c0; /* 고전 게임판 느낌 배경 */
    border: 3px solid #7b7b7b;
    border-radius: 4px;
    display: inline-block; /* 내부 그리드 크기에 맞춤 */
}

#game-board {
    display: grid;
    border: 1px solid #999; /* 게임판 내부 테두리 */
}

.cell {
    /* 너비와 높이는 JavaScript에서 동적으로 설정 */
    border: 1px solid #9e9e9e; /* 셀 테두리 */
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1em; /* 셀 내부 텍스트 크기 조절은 여기서 */
    font-weight: bold;
    background-color: #dcdcdc; /* 기본 셀 배경 */
    cursor: pointer;
    user-select: none;
    transition: background-color 0.1s ease;
}

.cell:hover:not(.revealed) { /* 아직 열리지 않은 셀에 마우스 오버 */
    background-color: #e8e8e8;
}

.cell.revealed {
    background-color: #bdbdbd; /* 열린 셀 배경 */
    cursor: default;
    border: 1px solid #a0a0a0;
    box-shadow: inset 1px 1px 2px rgba(0,0,0,0.1); /* 약간의 입체감 */
}

.cell.mine {
    background-color: #e74c3c; /* 지뢰 셀 배경 (빨간색) */
    color: white;
    font-size: 1.2em; /* 아이콘 크기 조절 */
}
.cell.mine.revealed { /* 게임오버 시, 깃발이 없던 지뢰*/
     background-color: #ff7675;
}


.cell.flagged::after {
    content: '🚩';
    font-size: 1.1em; /* 깃발 크기 */
    color: #c0392b; /* 깃발 색상 */
}
.cell.flagged.mine::after { /* 게임 승리 시, 올바르게 꽂힌 깃발 */
    filter: grayscale(0%); /* 원래 색상 */
}
.cell.flagged:not(.mine).revealed::after { /* 게임 종료 시, 잘못 꽂힌 깃발 */
    content: '❌'; /* 잘못된 깃발 표시 (예시) */
    color: #333;
}


/* 숫자 색상 */
.cell.number-1 { color: #2980b9; } /* 파랑 */
.cell.number-2 { color: #27ae60; } /* 초록 */
.cell.number-3 { color: #d35400; } /* 주황 */
.cell.number-4 { color: #8e44ad; } /* 보라 */
.cell.number-5 { color: #c0392b; } /* 빨강 */
.cell.number-6 { color: #16a085; } /* 청록 */
.cell.number-7 { color: #2c3e50; } /* 진한 남색 */
.cell.number-8 { color: #7f8c8d; } /* 회색 */

#message {
    margin-top: 20px;
    padding: 12px;
    font-size: 1.2em;
    font-weight: bold;
    color: #333;
    border-radius: 6px;
    min-height: 2em; /* 메시지 영역 높이 유지 */
}

#message.win {
    background-color: #d4edda; /* 성공 메시지 배경 */
    color: #155724;         /* 성공 메시지 텍스트 */
    border: 1px solid #c3e6cb;
}

#message.lose {
    background-color: #f8d7da; /* 실패 메시지 배경 */
    color: #721c24;         /* 실패 메시지 텍스트 */
    border: 1px solid #f5c6cb;
}

.local-high-scores {
    margin-top: 30px;
    padding: 20px;
    background-color: #f9f9f9;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.local-high-scores h2 {
    font-size: 1.5em;
    color: #333;
    margin-bottom: 15px;
    text-align: center;
}

#high-scores-list div {
    padding: 8px 0;
    border-bottom: 1px solid #eee;
    font-size: 0.95em;
    text-align: left; /* 목록은 왼쪽 정렬 */
}

#high-scores-list div:last-child {
    border-bottom: none;
}

/* 반응형 고려 (간단 예시) */
@media (max-width: 600px) {
    .game-header h1 {
        font-size: 2em;
    }
    .controls {
        flex-direction: column; /* 컨트롤 수직 정렬 */
        gap: 10px;
    }
    .controls select, .action-button {
        width: 100%; /* 작은 화면에서 컨트롤 너비 전체 사용 */
        box-sizing: border-box;
    }
    .game-info {
        flex-direction: column;
        gap: 10px;
    }
    .cell {
        /* 셀 크기 조절은 JavaScript에서 화면 크기에 따라 동적으로 변경하는 것이 좋음 */
    }
}

/* style.css 에 추가 */
.current-difficulty-top-score {
    margin-top: 20px;
    margin-bottom: 20px; /* 게임판과의 간격 */
    padding: 15px;
    background-color: #e9ecef; /* 약간 다른 배경색 */
    border-radius: 8px;
    text-align: center;
}

.current-difficulty-top-score h3 {
    margin-top: 0;
    margin-bottom: 8px;
    font-size: 1.2em;
    color: #495057;
}

#top-score-display {
    font-size: 1.1em;
    font-weight: bold;
    color: #007bff; /* 최고 기록 텍스트 색상 */
    min-height: 1.5em; /* 내용 없을 때도 높이 유지 */
}