.minesweeper-page {
    max-width: 100%;
    padding: 0 8px;
    height: 100%;
    justify-content: flex-start;
    padding-top: calc(var(--safe-top) + 8px);
}

.ms-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 8px 0;
}

.ms-back {
    background: none;
    border: none;
    color: var(--gold);
    font-size: 0.85rem;
    cursor: pointer;
    padding: 8px;
}

.ms-title {
    font-size: 1.1rem;
    font-weight: 300;
    color: var(--white);
}

.ms-records-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px;
}

.ms-controls {
    width: 100%;
    margin-bottom: 8px;
}

.ms-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-secondary);
    border-radius: 4px;
    padding: 8px 16px;
    margin-bottom: 8px;
}

.ms-mines, .ms-timer {
    font-family: "Courier New", monospace;
    font-size: 1.2rem;
    color: var(--gold);
    min-width: 40px;
}

.ms-reset {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px 8px;
    transition: transform var(--transition-fast);
}

.ms-reset:active {
    transform: scale(0.9);
}

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

.ms-diff-btn {
    flex: 1;
    background: var(--bg-secondary);
    border: 1px solid transparent;
    border-radius: 4px;
    color: var(--gray);
    font-size: 0.75rem;
    padding: 6px 4px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.ms-diff-btn.active {
    border-color: var(--gold);
    color: var(--gold);
}

.ms-custom-panel {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 4px;
    margin-bottom: 8px;
}

.ms-custom-panel label {
    font-size: 0.75rem;
    color: var(--gray);
    display: flex;
    align-items: center;
    gap: 4px;
}

.ms-custom-panel input {
    width: 48px;
    background: var(--bg-primary);
    border: 1px solid var(--gold-dark);
    border-radius: 3px;
    color: var(--white);
    padding: 4px 6px;
    font-size: 0.8rem;
    text-align: center;
}

.ms-apply {
    background: var(--gold-dark);
    border: none;
    border-radius: 3px;
    color: var(--bg-primary);
    padding: 5px 12px;
    font-size: 0.75rem;
    cursor: pointer;
    font-weight: 600;
}

.ms-board-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    width: 100%;
    -webkit-overflow-scrolling: touch;
}

.ms-board {
    display: inline-grid;
    gap: 1px;
    background: var(--bg-secondary);
    border: 2px solid var(--gold-dark);
    border-radius: 4px;
    padding: 2px;
    touch-action: manipulation;
}

.ms-cell {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border-radius: 2px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    user-select: none;
    transition: background var(--transition-fast);
}

.ms-cell.revealed {
    background: var(--bg-primary);
    cursor: default;
}

.ms-cell.mine {
    background: var(--error);
}

.ms-cell.flagged::after {
    content: "🚩";
    font-size: 0.9rem;
}

.ms-cell[data-count="1"] { color: #4fc3f7; }
.ms-cell[data-count="2"] { color: #81c784; }
.ms-cell[data-count="3"] { color: #ff8a65; }
.ms-cell[data-count="4"] { color: #7c4dff; }
.ms-cell[data-count="5"] { color: #ff5252; }
.ms-cell[data-count="6"] { color: #4dd0e1; }
.ms-cell[data-count="7"] { color: #fff176; }
.ms-cell[data-count="8"] { color: #bdbdbd; }

.ms-records-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-secondary);
    border: 1px solid var(--gold-dark);
    border-radius: 8px;
    padding: 24px;
    min-width: 260px;
    z-index: 50;
}

.ms-records-panel h3 {
    font-size: 1rem;
    font-weight: 300;
    color: var(--gold);
    margin-bottom: 1rem;
}

.ms-records-list {
    text-align: left;
    font-size: 0.85rem;
    color: var(--white-soft);
    line-height: 2;
}

.ms-close-records {
    margin-top: 1rem;
    background: none;
    border: 1px solid var(--gold-dark);
    color: var(--gold);
    padding: 6px 16px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.8rem;
}

.ms-win-banner {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-secondary);
    border: 2px solid var(--gold);
    border-radius: 12px;
    padding: 32px;
    text-align: center;
    z-index: 200;
    animation: fadeInUp var(--transition-normal) ease;
}

.ms-win-banner h3 {
    color: var(--gold);
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.ms-win-banner p {
    color: var(--white-soft);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.ms-win-banner .new-record {
    color: var(--gold-light);
    font-size: 0.8rem;
}
