/* 지뢰찾기 */

.minesweeper-container {
    max-width: 580px;
    margin: 0 auto;
    padding: 40px 16px 80px;
    padding-bottom: calc(50px + 20px);
    font-family: 'Pretendard', sans-serif;
    min-height: 100vh;
}

.ms-header {
    text-align: center;
    margin-bottom: 24px;
}

.ms-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #333;
    margin: 0 0 8px 0;
}

.ms-subtitle {
    font-size: 0.9rem;
    color: #666;
    margin: 0;
}

/* 게임 방법 */
.ms-howto {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 16px 18px;
    margin-bottom: 20px;
    border: 1px solid #e9ecef;
}

.ms-howto-title {
    font-size: 1rem;
    font-weight: 700;
    color: #333;
    margin: 0 0 10px 0;
}

.ms-howto-list {
    margin: 0;
    padding-left: 1.2rem;
    font-size: 0.9rem;
    line-height: 1.65;
    color: #444;
}

.ms-howto-list li {
    margin-bottom: 6px;
}

.ms-howto-list li:last-child {
    margin-bottom: 0;
}

/* 컨트롤 */
.ms-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.ms-difficulty {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ms-control-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #555;
}

.ms-difficulty-buttons {
    display: flex;
    gap: 6px;
}

.ms-diff-btn {
    padding: 8px 14px;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    color: #555;
    background: #f0f0f0;
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.ms-diff-btn:hover {
    background: #e5e5e5;
    color: #333;
}

.ms-diff-btn.active {
    background: #2c3e50;
    color: #fff;
    border-color: #2c3e50;
}

.ms-new-btn {
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    color: #fff;
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.ms-new-btn:hover {
    background: linear-gradient(135deg, #2980b9 0%, #1f6dad 100%);
}

/* 상태 바 */
.ms-status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 360px;
    margin: 0 auto 16px;
    padding: 10px 16px;
    background: #2c3e50;
    border-radius: 10px;
    color: #fff;
    font-variant-numeric: tabular-nums;
}

.ms-mine-counter,
.ms-timer {
    font-size: 1.1rem;
    font-weight: 700;
    min-width: 70px;
}

.ms-mine-counter {
    text-align: left;
}

.ms-timer {
    text-align: right;
}

.ms-face-btn {
    font-size: 1.6rem;
    background: none;
    border: none;
    cursor: pointer;
    line-height: 1;
    padding: 4px 8px;
    border-radius: 8px;
    transition: background 0.15s;
}

.ms-face-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* 게임판 */
.ms-board-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.ms-board {
    display: inline-grid;
    background: #999;
    border: 3px solid #666;
    border-radius: 4px;
    gap: 1px;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

.ms-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    cursor: pointer;
    border: none;
    padding: 0;
    font-family: inherit;
    transition: background 0.1s;
    -webkit-tap-highlight-color: transparent;
}

/* 닫힌 셀 */
.ms-cell--closed {
    background: #c0c0c0;
    border-top: 2px solid #fff;
    border-left: 2px solid #fff;
    border-right: 2px solid #808080;
    border-bottom: 2px solid #808080;
}

.ms-cell--closed:hover {
    background: #d0d0d0;
}

.ms-cell--closed:active {
    border: 1px solid #999;
    background: #b0b0b0;
}

/* 깃발 */
.ms-cell--flag {
    background: #c0c0c0;
    border-top: 2px solid #fff;
    border-left: 2px solid #fff;
    border-right: 2px solid #808080;
    border-bottom: 2px solid #808080;
    font-size: inherit;
}

/* 열린 셀 */
.ms-cell--open {
    background: #d9d9d9;
    border: 1px solid #bbb;
    cursor: default;
}

/* 숫자 색상 */
.ms-cell--n1 { color: #0000ff; }
.ms-cell--n2 { color: #008000; }
.ms-cell--n3 { color: #ff0000; }
.ms-cell--n4 { color: #000080; }
.ms-cell--n5 { color: #800000; }
.ms-cell--n6 { color: #008080; }
.ms-cell--n7 { color: #000000; }
.ms-cell--n8 { color: #808080; }

/* 지뢰 */
.ms-cell--mine {
    background: #ff4444;
    border: 1px solid #bbb;
    cursor: default;
}

.ms-cell--mine-other {
    background: #d9d9d9;
    border: 1px solid #bbb;
    cursor: default;
}

/* 잘못된 깃발 */
.ms-cell--wrong-flag {
    background: #d9d9d9;
    border: 1px solid #bbb;
    cursor: default;
    text-decoration: line-through;
    text-decoration-color: #ff0000;
}

/* 메시지 */
.ms-message {
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    margin: 0 0 8px 0;
    min-height: 1.5em;
    color: #333;
}

.ms-message:empty {
    visibility: hidden;
}

/* 기록 */
.ms-record {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.ms-record-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
}

.ms-record-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #333;
    margin: 0;
}

.ms-record-clear-btn {
    padding: 8px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    color: #666;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
}

.ms-record-clear-btn:hover {
    background: #e5e5e5;
    color: #333;
}

.ms-record-empty {
    font-size: 0.9rem;
    color: #888;
    margin: 0 0 12px 0;
}

.ms-record-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ms-record-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #f5f5f5;
    border-radius: 10px;
    font-size: 0.9rem;
}

.ms-record-item .record-level {
    font-weight: 700;
    color: #2c3e50;
    min-width: 48px;
}

.ms-record-item .record-time {
    font-weight: 600;
    color: #27ae60;
}

.ms-record-item .record-date {
    margin-left: auto;
    font-size: 0.8rem;
    color: #888;
}

/* 반응형 */
@media (max-width: 420px) {
    .ms-controls {
        flex-direction: column;
        align-items: stretch;
    }
    .ms-difficulty {
        justify-content: center;
    }
    .ms-diff-btn {
        flex: 1;
    }
    .ms-new-btn {
        text-align: center;
    }
}
