/* ============================================================
   minesweeper.css — 扫雷页专用样式
   配色引用 /assets/css/site.css 的 --site-* 令牌，亮暗切换跟着站点走。
   ============================================================ */

.game-page {
    min-height: 100vh;
    background-color: var(--bs-body-bg);
}

.game-bar {
    border-bottom: 1px solid var(--site-border);
    background-color: var(--site-surface);
}

.game-brand {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    font-weight: 600;
    font-size: .95rem;
    color: inherit;
    text-decoration: none;
}

.game-back {
    font-size: .85rem;
    color: var(--bs-secondary-color);
    text-decoration: none;
}

.game-back:hover {
    color: var(--site-accent);
}

.game-main {
    padding: 1.5rem 0 3rem;
}

.game-panel {
    max-width: 560px;
    margin: 0 auto;
}

/* ---------- 数值条 ---------- */

.game-hud {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    padding: .75rem .9rem;
    border: 1px solid var(--site-border);
    border-radius: var(--site-radius);
    background-color: var(--site-surface);
}

.hud-item {
    display: flex;
    flex-direction: column;
    gap: .15rem;
}

.hud-item.hud-diff {
    margin-left: auto;
}

.hud-label {
    font-size: .72rem;
    color: var(--bs-secondary-color);
}

.hud-value {
    font-size: 1.05rem;
    font-variant-numeric: tabular-nums;
}

.diff-group {
    display: inline-flex;
    gap: .25rem;
    padding: .15rem;
    border: 1px solid var(--site-border);
    border-radius: 999px;
}

.diff-btn {
    padding: .15rem .55rem;
    border: 0;
    border-radius: 999px;
    background: none;
    font-size: .78rem;
    color: var(--bs-secondary-color);
    cursor: pointer;
}

.diff-btn.is-active {
    background-color: var(--site-accent);
    color: #0b1118;
}

/* ---------- 模式切换 ---------- */

.ms-toolbar {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin: .75rem 0;
}

.mode-group {
    display: inline-flex;
    gap: .25rem;
    padding: .15rem;
    border: 1px solid var(--site-border);
    border-radius: 999px;
}

.mode-btn {
    padding: .25rem .7rem;
    border: 0;
    border-radius: 999px;
    background: none;
    font-size: .82rem;
    color: var(--bs-secondary-color);
    cursor: pointer;
}

.mode-btn.is-active {
    background-color: var(--site-row-hover);
    color: var(--bs-body-color);
}

/* ---------- 棋盘 ---------- */

.stage {
    position: relative;
    display: flex;
    justify-content: center;
}

.ms-board {
    --cols: 9;
    --fs: 15px;
    display: grid;
    grid-template-columns: repeat(var(--cols), 1fr);
    gap: 2px;
    width: 100%;
    max-width: 520px;
    padding: 6px;
    border: 1px solid var(--site-border);
    border-radius: var(--site-radius);
    background-color: var(--site-surface);
    user-select: none;
    touch-action: manipulation;
}

.ms-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1 / 1;
    padding: 0;
    border: 0;
    border-radius: 4px;
    background-color: var(--site-row-hover);
    color: var(--bs-body-color);
    font-size: var(--fs);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    cursor: pointer;
    transition: background-color .12s ease;
}

.ms-cell:hover:not(.is-open) {
    background-color: var(--site-border);
}

.ms-cell.is-open {
    background-color: transparent;
    cursor: default;
}

.ms-cell.is-flag {
    color: var(--site-accent);
}

.ms-cell.is-mine {
    background-color: #b3362c;
    color: #fff;
}

.ms-cell.is-wrong {
    background-color: #6b4a12;
    color: #ffd27a;
}

.ms-cell.is-boom {
    outline: 2px solid #ff6b5e;
    outline-offset: -2px;
}

/* 数字配色：亮暗主题都能看清 */
.ms-cell.n1 { color: #4b8ef7; }
.ms-cell.n2 { color: #3faf6a; }
.ms-cell.n3 { color: #e05a4f; }
.ms-cell.n4 { color: #9272d6; }
.ms-cell.n5 { color: #c9552f; }
.ms-cell.n6 { color: #2fa3a3; }
.ms-cell.n7 { color: #7a6a58; }
.ms-cell.n8 { color: #8d8d8d; }

/* ---------- 遮罩 ---------- */

.ms-overlay {
    position: absolute;
    inset: 0;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: 1.25rem;
    border-radius: var(--site-radius);
    background-color: rgba(10, 16, 22, .88);
    background-color: color-mix(in srgb, var(--bs-body-bg) 88%, transparent);
    text-align: center;
    backdrop-filter: blur(2px);
}

.ms-overlay.is-active {
    display: flex;
}

.ms-emoji {
    margin: 0;
    font-size: 2rem;
}

.ms-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 600;
}

.ms-desc {
    max-width: 22rem;
    margin: 0;
    font-size: .85rem;
    color: var(--bs-secondary-color);
}

.game-foot {
    margin-top: .9rem;
    text-align: center;
}

.game-hint {
    margin: 0;
    font-size: .78rem;
    color: var(--bs-secondary-color);
}
