/* 扫雷 - 经典 Windows 风格；格子尺寸由 JS 按视口计算（--ms-cell-size） */
.ms-main {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: min(960px, 100%);
    margin: 0 auto 32px;
    padding: 0 12px 24px;
    box-sizing: border-box;
}

.ms-panel {
    width: 100%;
    box-sizing: border-box;
    background: linear-gradient(180deg, #c0c0c0 0%, #a8a8a8 100%);
    border: 3px solid;
    border-color: #fff #808080 #808080 #fff;
    border-radius: 4px;
    padding: 10px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.ms-hud {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
    padding: 6px 8px;
    background: #c0c0c0;
    border: 2px solid;
    border-color: #808080 #fff #fff #808080;
}

.ms-counter {
    font-family: 'Courier New', Consolas, monospace;
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
    color: #ff0000;
    background: #000;
    padding: 4px 8px;
    min-width: 62px;
    text-align: center;
    letter-spacing: 2px;
}

.ms-face {
    width: 44px;
    height: 44px;
    font-size: 26px;
    line-height: 44px;
    text-align: center;
    background: #c0c0c0;
    border: 2px solid;
    border-color: #fff #808080 #808080 #fff;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
}

.ms-face:active {
    border-color: #808080 #fff #fff #808080;
}

.ms-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 12px;
}

.ms-toolbar label {
    color: rgba(255, 255, 255, 0.85);
    font-size: 14px;
}

.ms-select {
    background: rgba(26, 26, 46, 0.9);
    border: 1px solid rgba(212, 175, 55, 0.45);
    color: #fff;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 14px;
}

.ms-status {
    text-align: center;
    color: rgba(255, 255, 255, 0.75);
    font-size: 14px;
    margin-bottom: 10px;
}

.ms-status.is-win {
    color: #7dffb8;
}

.ms-status.is-lose {
    color: #ffb4b4;
}

.ms-grid-wrap {
    width: 100%;
    overflow: hidden;
    border: 3px solid;
    border-color: #808080 #fff #fff #808080;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    box-sizing: border-box;
}

.ms-grid {
    display: grid;
    gap: 0;
    background: #bdbdbd;
    user-select: none;
    touch-action: manipulation;
    grid-template-columns: repeat(var(--ms-cols, 9), var(--ms-cell-size, 28px));
    grid-template-rows: repeat(var(--ms-rows, 9), var(--ms-cell-size, 28px));
    width: calc(var(--ms-cols, 9) * var(--ms-cell-size, 28px));
    height: calc(var(--ms-rows, 9) * var(--ms-cell-size, 28px));
}

.ms-cell {
    width: var(--ms-cell-size, 28px);
    height: var(--ms-cell-size, 28px);
    min-width: 0;
    min-height: 0;
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    border: 2px solid;
    border-color: #fff #808080 #808080 #fff;
    background: #c0c0c0;
    font-family: 'Arial', sans-serif;
    font-size: var(--ms-cell-font, 16px);
    font-weight: 700;
    line-height: var(--ms-cell-size, 28px);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.ms-cell.is-hidden:active {
    border-color: #808080 #fff #fff #808080;
}

.ms-cell.is-revealed,
.ms-cell.is-empty {
    border: 1px solid #9a9a9a;
    background: #d4d4d4;
    cursor: default;
}

.ms-cell.is-flagged {
    background: #c0c0c0;
    color: #e00;
    font-size: var(--ms-cell-font, 14px);
}

.ms-cell.is-mine {
    border: 1px solid #9a9a9a;
    background: #d4d4d4;
    font-size: var(--ms-cell-font, 14px);
    cursor: default;
}

.ms-cell.is-boom {
    background: #e53935;
}

.ms-cell.is-n1 { color: #0000ff; }
.ms-cell.is-n2 { color: #008000; }
.ms-cell.is-n3 { color: #ff0000; }
.ms-cell.is-n4 { color: #000080; }
.ms-cell.is-n5 { color: #800000; }
.ms-cell.is-n6 { color: #008080; }
.ms-cell.is-n7 { color: #000000; }
.ms-cell.is-n8 { color: #808080; }

.ms-hint {
    text-align: center;
    margin-top: 12px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1.6;
}

.ms-vol-wrap {
    position: relative;
}

.ms-btn-vol {
    min-width: 42px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    border-radius: 10px;
    cursor: pointer;
}

.ms-btn-vol.is-muted {
    background: rgba(255, 107, 107, 0.35);
}

.ms-vol-popup {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    min-width: 180px;
    padding: 12px 14px;
    background: linear-gradient(180deg, #1a2d4a 0%, #0f1a2e 100%);
    border: 1px solid rgba(212, 175, 55, 0.45);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    z-index: 100;
}

.ms-vol-popup[hidden] {
    display: none !important;
}

.ms-vol-popup label {
    color: rgba(255, 255, 255, 0.8);
    font-size: 12px;
    display: block;
    margin-bottom: 6px;
}

.ms-vol-range {
    width: 100%;
    accent-color: #d4af37;
}

@media (max-width: 768px) {
    .ms-counter {
        font-size: 22px;
        min-width: 50px;
    }

    .ms-face {
        width: 40px;
        height: 40px;
        line-height: 40px;
        font-size: 22px;
    }
}

/* 手机横屏：仅保留扫雷面板（HUD + 棋盘） */
@media (orientation: landscape) and (max-height: 520px) and (max-width: 960px) {
    body.ms-landscape-play {
        overflow: hidden;
    }

    body.ms-landscape-play .game-container::before {
        display: none;
    }

    body.ms-landscape-play .home-btn,
    body.ms-landscape-play .reward-btn-game,
    body.ms-landscape-play .game-header,
    body.ms-landscape-play .ms-toolbar,
    body.ms-landscape-play .ms-status,
    body.ms-landscape-play .ms-hint {
        display: none !important;
    }

    body.ms-landscape-play .game-container {
        min-height: 100vh;
        min-height: 100dvh;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0;
    }

    body.ms-landscape-play .ms-main {
        width: 100%;
        max-width: 100%;
        margin: 0;
        padding: 4px 6px;
        box-sizing: border-box;
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: center;
        min-height: 0;
    }

    body.ms-landscape-play .ms-panel {
        flex: 1;
        display: flex;
        flex-direction: column;
        min-height: 0;
        max-height: calc(100dvh - 8px);
        padding: 6px;
    }

    body.ms-landscape-play .ms-hud {
        flex-shrink: 0;
        margin-bottom: 6px;
        padding: 4px 6px;
    }

    body.ms-landscape-play .ms-grid-wrap {
        flex: 1;
        min-height: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: hidden;
    }

    body.ms-landscape-play .ms-counter {
        font-size: 20px;
        min-width: 46px;
        padding: 2px 6px;
    }

    body.ms-landscape-play .ms-face {
        width: 36px;
        height: 36px;
        line-height: 36px;
        font-size: 20px;
    }
}
