/* Minesweeper Game Styles */

.minesweeper-container {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 60px);
    padding: 0;
    max-width: 100%;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    /* Allow canvas section to scroll internally - don't clip it */
    overflow: visible;
}

.minesweeper-controls-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    flex-wrap: wrap;
    flex-shrink: 0;
}

.minesweeper-stats {
    display: flex;
    gap: 15px;
    font-weight: bold;
    color: #333;
}

.minesweeper-stats.compact {
    font-size: 12px !important;
}

.minesweeper-stats label {
    padding: 5px 10px;
    background: #f0f0f0;
    border-radius: 4px;
    font-size: 14px;
}

.minesweeper-action-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.minesweeper-action-buttons label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
}

.minesweeper-select {
    padding: 4px 8px;
    font-size: 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: white;
    cursor: pointer;
}

.minesweeper-canvas-section {
    flex: 1;
    display: block;  /* Changed from flex to block for proper scroll behavior */
    background: #0a0a0a;
    padding: 10px;
    /* CRITICAL: Force scrollbars for larger grids */
    overflow-x: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    width: 100%;
    min-height: 400px;
    /* Allow touch scrolling */
    touch-action: pan-x pan-y;
}

/* ADDED: Wrapper to properly contain the canvas and enable scrolling */
.minesweeper-canvas-wrapper {
    display: inline-block;
    /* Let the wrapper size to the canvas content */
    min-width: min-content;
}

.minesweeper-canvas {
    border: 3px solid #4a90d9;
    background: #c0c0c0;
    box-shadow: 0 0 20px rgba(74, 144, 217, 0.3);
    display: block;
    cursor: pointer;
    /* Allow pan gestures for scrolling - JS handles tap detection */
    touch-action: pan-x pan-y;
}

.minesweeper-controls-bottom {
    display: flex;
    gap: 15px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    flex-wrap: wrap;
    justify-content: space-around;
    flex-shrink: 0;
}

.minesweeper-control-column {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 180px;
}

.minesweeper-control-column h4 {
    margin: 0 0 5px 0;
    color: #16213e;
    font-size: 14px;
    font-weight: bold;
    border-bottom: 2px solid #4a90d9;
    padding-bottom: 3px;
}

.minesweeper-info {
    padding: 10px;
    background: rgba(255, 255, 255, 0.95);
    text-align: center;
    font-size: 13px;
    color: #555;
    flex-shrink: 0;
}

.minesweeper-info strong {
    color: #16213e;
}

.minesweeper-btn {
    padding: 4px 10px !important;
    font-size: 12px !important;
    border: none;
    border-radius: 4px;
    background: #16213e;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.minesweeper-btn:hover {
    background: #1a3a5c;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(74, 144, 217, 0.3);
}

/* ADDED: Scroll hint for mobile users on larger grids */
.minesweeper-scroll-hint {
    display: none;
    text-align: center;
    padding: 5px 10px;
    background: #fff3cd;
    color: #856404;
    font-size: 12px;
    border-top: 1px solid #ffc107;
}

@media (max-width: 768px) {
    .minesweeper-controls-top {
        flex-direction: column;
        align-items: flex-start;
    }

    .minesweeper-controls-bottom {
        flex-direction: column;
    }

    .minesweeper-canvas-section {
        min-height: 300px;
        /* Force horizontal scroll on mobile */
        overflow-x: scroll;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 10px;
        max-height: calc(100vh - 250px);
        /* Allow touch pan gestures */
        touch-action: pan-x pan-y;
    }

    .minesweeper-stats {
        flex-wrap: wrap;
    }

    /* Show scroll hint on mobile when grid might need scrolling */
    .minesweeper-scroll-hint {
        display: block;
    }
}

@media (max-width: 480px) {
    .minesweeper-stats label {
        font-size: 11px;
        padding: 3px 6px;
    }

    .minesweeper-select {
        font-size: 11px;
    }

    .minesweeper-canvas-section {
        /* Smaller padding on very small screens */
        padding: 5px;
        /* More room for the grid */
        max-height: calc(100vh - 220px);
    }
}
