body {
    min-height: 100vh;
    background-color: #0b1120;
    background-image: radial-gradient(ellipse at 30% 20%, rgba(30, 58, 138, 0.12) 0%, transparent 60%),
                      radial-gradient(ellipse at 70% 80%, rgba(88, 28, 135, 0.10) 0%, transparent 60%);
    color: #e2e8f0;
    font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}


header { text-align: center; padding: 50px 16px 20px; }
h1 { font-size: 1.8rem; font-weight: 700; margin: 0; letter-spacing: 0.02em; }

main {
    width: 100%;
    max-width: 900px;
    padding: 0 16px 60px;
}

/* ---- toolbar ---- */
.toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    padding: 16px 20px;
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: 14px;
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
}

.difficulty label {
    display: block;
    font-size: 0.75rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 6px;
}
.btn-group { display: flex; gap: 4px; }
.diff-btn {
    padding: 6px 12px;
    font-size: 0.78rem;
    font-weight: 600;
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: 8px;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.diff-btn:hover { background: rgba(148, 163, 184, 0.08); }
.diff-btn.active {
    background: rgba(96, 165, 250, 0.15);
    border-color: rgba(96, 165, 250, 0.4);
    color: #93c5fd;
}

.stats {
    display: flex;
    gap: 20px;
    margin-left: auto;
}
.stat {
    text-align: center;
    min-width: 60px;
}
.stat-label {
    display: block;
    font-size: 0.7rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 2px;
}
.stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #e2e8f0;
}

.restart-btn {
    padding: 8px 18px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid rgba(129, 140, 248, 0.3);
    border-radius: 10px;
    background: rgba(129, 140, 248, 0.1);
    color: #a5b4fc;
    cursor: pointer;
    transition: all 0.2s;
}
.restart-btn:hover { background: rgba(129, 140, 248, 0.2); }

/* ---- board ---- */
.board-wrapper {
    display: flex;
    justify-content: center;
    overflow-x: auto;
}
#board {
    border-collapse: collapse;
    user-select: none;
    -webkit-user-select: none;
}
#board td {
    width: 34px;
    height: 34px;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 700;
    vertical-align: middle;
    cursor: pointer;
    border: 1px solid rgba(148, 163, 184, 0.12);
    background: rgba(30, 41, 59, 0.6);
    transition: background 0.1s;
}
#board td:hover { background: rgba(148, 163, 184, 0.1); }
#board td.revealed {
    background: rgba(15, 23, 42, 0.7);
    cursor: default;
}
#board td.revealed:hover { background: rgba(15, 23, 42, 0.7); }
#board td.mine-hit {
    background: rgba(239, 68, 68, 0.3) !important;
}

/* ---- status ---- */
.status {
    text-align: center;
    margin-top: 16px;
    font-size: 1rem;
    font-weight: 600;
    min-height: 28px;
}
.status.win { color: #86efac; }
.status.lose { color: #fca5a5; }

/* ---- responsive ---- */
@media (max-width: 600px) {
    .toolbar { flex-direction: column; align-items: stretch; }
    .stats { margin-left: 0; justify-content: center; }
    header { padding-top: 60px; }
    #board td { width: 28px; height: 28px; font-size: 0.75rem; }
}
