/* Minesweeper Game Styles */

/* CSS Variables for Theme System */
:root {
    /* Modern Theme (Default) */
    --bg-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --bg-secondary: rgba(255, 255, 255, 0.95);
    --bg-overlay: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    --text-primary: #ffffff;
    --text-secondary: #333;
    --text-accent: rgba(255, 255, 255, 0.9);
    --cell-bg: linear-gradient(145deg, #f0f0f0, #e0e0e0);
    --cell-revealed: linear-gradient(145deg, #ffffff, #f5f5f5);
    --cell-flagged: linear-gradient(145deg, #ff6b6b, #ff5252);
    --cell-mine: linear-gradient(145deg, #ff4757, #ff3742);
    --button-primary: linear-gradient(145deg, #ffd700, #ffed4e);
    --shadow-primary: 0 10px 40px rgba(0, 0, 0, 0.15);
    --shadow-hover: 0 15px 50px rgba(0, 0, 0, 0.2);
    --border-glass: 1px solid rgba(255, 255, 255, 0.3);
}

/* Classic Theme */
[data-theme="classic"] {
    --bg-primary: linear-gradient(135deg, #c0c0c0 0%, #808080 100%);
    --bg-secondary: #c0c0c0;
    --bg-overlay: none;
    --text-primary: #000000;
    --text-secondary: #000000;
    --text-accent: #000000;
    --cell-bg: #c0c0c0;
    --cell-revealed: #ffffff;
    --cell-flagged: #ff0000;
    --cell-mine: #ff0000;
    --button-primary: #c0c0c0;
    --shadow-primary: inset -2px -2px 4px #808080, inset 2px 2px 4px #ffffff;
    --shadow-hover: inset -3px -3px 6px #808080, inset 3px 3px 6px #ffffff;
    --border-glass: 2px outset #c0c0c0;
}

/* Dark Theme */
[data-theme="dark"] {
    --bg-primary: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    --bg-secondary: rgba(30, 30, 30, 0.95);
    --bg-overlay: linear-gradient(135deg, rgba(26, 26, 46, 0.1) 0%, rgba(22, 33, 62, 0.1) 100%);
    --text-primary: #ffffff;
    --text-secondary: #e0e0e0;
    --text-accent: rgba(255, 255, 255, 0.8);
    --cell-bg: linear-gradient(145deg, #2a2a2a, #1a1a1a);
    --cell-revealed: linear-gradient(145deg, #3a3a3a, #2a2a2a);
    --cell-flagged: linear-gradient(145deg, #ff6b6b, #ff5252);
    --cell-mine: linear-gradient(145deg, #ff4757, #ff3742);
    --button-primary: linear-gradient(145deg, #4a4a4a, #3a3a3a);
    --shadow-primary: 0 10px 40px rgba(0, 0, 0, 0.5);
    --shadow-hover: 0 15px 50px rgba(0, 0, 0, 0.7);
    --border-glass: 1px solid rgba(255, 255, 255, 0.1);
}

/* Rainbow Theme */
[data-theme="rainbow"] {
    --bg-primary: linear-gradient(135deg, #ff6b6b 0%, #4ecdc4 25%, #45b7d1 50%, #96ceb4 75%, #ffeaa7 100%);
    --bg-secondary: rgba(255, 255, 255, 0.95);
    --bg-overlay: linear-gradient(135deg, rgba(255, 107, 107, 0.1) 0%, rgba(78, 205, 196, 0.1) 100%);
    --text-primary: #ffffff;
    --text-secondary: #333;
    --text-accent: rgba(255, 255, 255, 0.9);
    --cell-bg: linear-gradient(145deg, #ffeaa7, #fdcb6e);
    --cell-revealed: linear-gradient(145deg, #ffffff, #f8f9fa);
    --cell-flagged: linear-gradient(145deg, #e17055, #d63031);
    --cell-mine: linear-gradient(145deg, #fd79a8, #e84393);
    --button-primary: linear-gradient(145deg, #00b894, #00a085);
    --shadow-primary: 0 10px 40px rgba(0, 0, 0, 0.15);
    --shadow-hover: 0 15px 50px rgba(0, 0, 0, 0.2);
    --border-glass: 1px solid rgba(255, 255, 255, 0.3);
}

/* Game Container */
.game-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background: var(--bg-primary);
    min-height: calc(100vh - 120px);
    position: relative;
    transition: all 0.3s ease;
}

.game-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-overlay);
    pointer-events: none;
}

.game-header {
    text-align: center;
    margin-bottom: 30px;
    position: relative;
    z-index: 1;
}

.game-header h1 {
    font-size: 2.5rem;
    color: var(--text-primary);
    margin-bottom: 10px;
    font-weight: bold;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    transition: color 0.3s ease;
}

.game-subtitle {
    font-size: 1.1rem;
    color: var(--text-accent);
    margin: 0;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    transition: color 0.3s ease;
}

/* Game Controls */
.game-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    position: relative;
    z-index: 1;
    flex-wrap: wrap;
}

.difficulty-selector, .theme-selector, .explosion-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-secondary);
    padding: 12px 20px;
    border-radius: 15px;
    box-shadow: var(--shadow-primary);
    backdrop-filter: blur(10px);
    border: var(--border-glass);
    transition: all 0.3s ease;
}

.difficulty-selector:hover, .theme-selector:hover, .explosion-selector:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.difficulty-selector label, .theme-selector label, .explosion-selector label {
    font-weight: bold;
    color: var(--text-secondary);
    font-size: 15px;
    transition: color 0.3s ease;
}

.difficulty-selector select, .theme-selector select, .explosion-selector select {
    padding: 8px 12px;
    border: none;
    background: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    border-radius: 10px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    cursor: pointer;
    color: var(--text-secondary);
}

.difficulty-selector select:focus, .theme-selector select:focus, .explosion-selector select:focus {
    outline: none;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1), 0 0 0 3px rgba(102, 126, 234, 0.3);
}

/* Dark theme adjustments for selects */
[data-theme="dark"] .difficulty-selector select,
[data-theme="dark"] .theme-selector select,
[data-theme="dark"] .explosion-selector select {
    background: rgba(60, 60, 60, 0.8);
    color: #e0e0e0;
}

[data-theme="classic"] .difficulty-selector select,
[data-theme="classic"] .theme-selector select,
[data-theme="classic"] .explosion-selector select {
    background: #ffffff;
    color: #000000;
    box-shadow: inset -1px -1px 2px #808080, inset 1px 1px 2px #ffffff;
}

/* Sound Toggle Button */
.sound-toggle {
    background: var(--bg-secondary);
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-primary);
    backdrop-filter: blur(10px);
    border: var(--border-glass);
    position: relative;
    overflow: hidden;
}

.sound-toggle::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.5s ease;
}

.sound-toggle:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: var(--shadow-hover);
}

.sound-toggle:hover::before {
    left: 100%;
}

.sound-toggle:active {
    transform: translateY(0) scale(0.95);
}

.sound-toggle.muted {
    background: rgba(255, 107, 107, 0.9);
    box-shadow: 0 8px 32px rgba(255, 107, 107, 0.2);
}

.sound-toggle.muted:hover {
    background: rgba(255, 107, 107, 1);
    box-shadow: 0 12px 40px rgba(255, 107, 107, 0.3);
}

.sound-icon {
    font-size: 24px;
    line-height: 1;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
    transition: all 0.2s ease;
}

.sound-toggle:hover .sound-icon {
    transform: scale(1.1);
}

/* Game Board Container */
.game-board-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 30px;
    position: relative;
    z-index: 1;
}

/* Game Info Panel */
.game-info {
    margin-bottom: 15px;
}

.info-panel {
    display: flex;
    align-items: center;
    gap: 20px;
    background: var(--bg-secondary);
    padding: 15px 25px;
    border-radius: 20px;
    box-shadow: var(--shadow-primary);
    backdrop-filter: blur(10px);
    border: var(--border-glass);
    transition: all 0.3s ease;
}

.info-panel:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.mine-counter, .timer {
    display: flex;
    align-items: center;
    gap: 8px;
}

.counter-label {
    font-weight: bold;
    color: var(--text-secondary);
    font-size: 14px;
    transition: color 0.3s ease;
}

.counter-display {
    background: linear-gradient(145deg, #1a1a1a, #000);
    color: #00ff41;
    font-family: 'Courier New', monospace;
    font-size: 18px;
    font-weight: bold;
    padding: 8px 12px;
    border-radius: 8px;
    min-width: 50px;
    text-align: center;
    letter-spacing: 1px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 255, 65, 0.2);
    text-shadow: 0 0 10px rgba(0, 255, 65, 0.5);
    transition: all 0.2s ease;
}

.counter-display:hover {
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5), 0 2px 12px rgba(0, 255, 65, 0.4);
    text-shadow: 0 0 15px rgba(0, 255, 65, 0.8);
}

/* Reset Button */
.reset-button {
    background: var(--button-primary);
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-primary);
    position: relative;
    overflow: hidden;
}

.reset-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.5s ease;
}

.reset-button:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: var(--shadow-hover);
}

.reset-button:hover::before {
    left: 100%;
}

.reset-button:active {
    transform: translateY(0) scale(0.95);
    box-shadow: 0 2px 10px rgba(255, 215, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.face-icon {
    font-size: 26px;
    line-height: 1;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
    transition: all 0.2s ease;
}

.reset-button:hover .face-icon {
    transform: scale(1.1);
}

/* Game Board */
.game-board {
    display: grid;
    gap: 1px;
    background: var(--bg-secondary);
    padding: 15px;
    border-radius: 20px;
    box-shadow: var(--shadow-hover);
    backdrop-filter: blur(10px);
    border: var(--border-glass);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.game-board::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-overlay);
    pointer-events: none;
}

/* Grid sizes for different difficulties */
.game-board.beginner {
    grid-template-columns: repeat(9, 1fr);
    grid-template-rows: repeat(9, 1fr);
}

.game-board.intermediate {
    grid-template-columns: repeat(16, 1fr);
    grid-template-rows: repeat(16, 1fr);
}

.game-board.expert {
    grid-template-columns: repeat(30, 1fr);
    grid-template-rows: repeat(16, 1fr);
}

/* Game Cells */
.cell {
    width: 28px;
    height: 28px;
    background: var(--cell-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    user-select: none;
    transition: all 0.2s ease;
    border-radius: 6px;
    box-shadow: var(--shadow-primary);
    position: relative;
    overflow: hidden;
}

.cell::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
    transition: left 0.3s ease;
}

.cell:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-hover);
    filter: brightness(1.1);
}

.cell:hover::before {
    left: 100%;
}

.cell:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.cell.revealed {
    background: var(--cell-revealed);
    cursor: default;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
    transform: none;
}

.cell.revealed:hover {
    background: var(--cell-revealed);
    transform: none;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
    filter: none;
}

.cell.revealed::before {
    display: none;
}

.cell.flagged {
    background: var(--cell-flagged);
    color: #ffffff;
    font-size: 16px;
    box-shadow: var(--shadow-primary);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.cell.flagged:hover {
    background: var(--cell-flagged);
    transform: translateY(-1px);
    box-shadow: var(--shadow-hover);
    filter: brightness(1.1);
}

.cell.mine {
    background: var(--cell-mine);
    color: #000;
    font-size: 16px;
    box-shadow: var(--shadow-primary);
}

.cell.mine-exploded {
    background: var(--cell-mine);
    animation: explode 0.5s ease-out;
    box-shadow: 0 0 20px rgba(255, 71, 87, 0.8), inset 0 0 10px rgba(255, 255, 255, 0.3);
}

@keyframes explode {
    0% { 
        transform: scale(1); 
        box-shadow: 0 0 20px rgba(255, 71, 87, 0.8);
    }
    25% { 
        transform: scale(1.3); 
        box-shadow: 0 0 30px rgba(255, 71, 87, 1), 0 0 40px rgba(255, 215, 0, 0.5);
    }
    50% { 
        transform: scale(1.1); 
        box-shadow: 0 0 25px rgba(255, 71, 87, 0.9), 0 0 35px rgba(255, 215, 0, 0.3);
    }
    100% { 
        transform: scale(1); 
        box-shadow: 0 0 20px rgba(255, 71, 87, 0.8);
    }
}

/* Number colors (modern Minesweeper) */
.cell.number-1 { 
    color: #4285f4; 
    text-shadow: 0 1px 2px rgba(66, 133, 244, 0.3);
    font-weight: 900;
}
.cell.number-2 { 
    color: #34a853; 
    text-shadow: 0 1px 2px rgba(52, 168, 83, 0.3);
    font-weight: 900;
}
.cell.number-3 { 
    color: #ea4335; 
    text-shadow: 0 1px 2px rgba(234, 67, 53, 0.3);
    font-weight: 900;
}
.cell.number-4 { 
    color: #673ab7; 
    text-shadow: 0 1px 2px rgba(103, 58, 183, 0.3);
    font-weight: 900;
}
.cell.number-5 { 
    color: #ff5722; 
    text-shadow: 0 1px 2px rgba(255, 87, 34, 0.3);
    font-weight: 900;
}
.cell.number-6 { 
    color: #00bcd4; 
    text-shadow: 0 1px 2px rgba(0, 188, 212, 0.3);
    font-weight: 900;
}
.cell.number-7 { 
    color: #795548; 
    text-shadow: 0 1px 2px rgba(121, 85, 72, 0.3);
    font-weight: 900;
}
.cell.number-8 { 
    color: #607d8b; 
    text-shadow: 0 1px 2px rgba(96, 125, 139, 0.3);
    font-weight: 900;
}

/* Game Instructions */
.game-instructions {
    background: var(--bg-secondary);
    padding: 25px;
    border-radius: 20px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-primary);
    backdrop-filter: blur(10px);
    border: var(--border-glass);
    position: relative;
    z-index: 1;
    transition: all 0.3s ease;
}

.game-instructions:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.game-instructions h3 {
    margin-top: 0;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 20px;
    transition: color 0.3s ease;
}

.instructions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.instruction-item {
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #007bff;
}

/* Hide mobile-specific instructions on desktop */
.instruction-item.mobile-only {
    display: none;
}

/* Show mobile-specific instructions on touch devices */
@media (hover: none) and (pointer: coarse) {
    .instruction-item.mobile-only {
        display: block;
        background: #e8f5e8;
        border-left-color: #28a745;
    }
}

/* Game Stats */
.game-stats {
    background: var(--bg-secondary);
    padding: 25px;
    border-radius: 20px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-primary);
    backdrop-filter: blur(10px);
    border: var(--border-glass);
    position: relative;
    z-index: 1;
    transition: all 0.3s ease;
}

.game-stats:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.game-stats h3 {
    margin-top: 0;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 20px;
    transition: color 0.3s ease;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
}

.stat-label {
    font-weight: bold;
    color: #666;
}

.stat-value {
    font-weight: bold;
    color: #007bff;
    font-size: 1.1em;
}

/* Share Section */
.share-section {
    background: var(--bg-secondary);
    padding: 25px;
    border-radius: 20px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-primary);
    backdrop-filter: blur(10px);
    border: var(--border-glass);
    text-align: center;
    position: relative;
    z-index: 1;
    transition: all 0.3s ease;
}

.share-section:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.share-section h3 {
    margin-top: 0;
    color: var(--text-secondary);
    margin-bottom: 20px;
    transition: color 0.3s ease;
}

.share-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.share-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
}

.share-btn.twitter {
    background: #1da1f2;
    color: white;
}

.share-btn.facebook {
    background: #4267b2;
    color: white;
}

.share-btn.copy {
    background: #28a745;
    color: white;
}

.share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* Related Games */
.related-games {
    background: var(--bg-secondary);
    padding: 25px;
    border-radius: 20px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-primary);
    backdrop-filter: blur(10px);
    border: var(--border-glass);
    position: relative;
    z-index: 1;
    transition: all 0.3s ease;
}

.related-games:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.related-games h3 {
    margin-top: 0;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 20px;
    transition: color 0.3s ease;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.game-card {
    text-decoration: none;
    color: inherit;
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.game-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    border-color: #007bff;
}

.game-icon {
    font-size: 2rem;
    margin-bottom: 10px;
}

.game-card h4 {
    margin: 10px 0 5px 0;
    color: #333;
}

.game-card p {
    margin: 0;
    color: #666;
    font-size: 0.9rem;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    animation: fadeIn 0.3s;
}

.modal-content {
    background-color: white;
    margin: 15% auto;
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    animation: slideIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-content h2 {
    margin-top: 0;
    color: #333;
    margin-bottom: 15px;
}

.modal-stats {
    display: flex;
    justify-content: space-around;
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.modal-stat {
    text-align: center;
}

.modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
}

.btn-primary, .btn-secondary {
    padding: 10px 20px;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
}

.btn-primary {
    background: #007bff;
    color: white;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-primary:hover, .btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* Mobile-First Responsive Design */

/* Large tablets and small desktops */
@media (max-width: 1024px) {
    .game-container {
        padding: 15px;
    }
    
    .game-controls {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .difficulty-selector, .theme-selector, .explosion-selector {
        min-width: 200px;
    }
}

/* Tablets */
@media (max-width: 768px) {
    .game-container {
        padding: 10px;
        min-height: calc(100vh - 80px);
    }
    
    .game-header h1 {
        font-size: 2rem;
        margin-bottom: 8px;
    }
    
    .game-subtitle {
        font-size: 1rem;
        margin-bottom: 20px;
    }
    
    .game-controls {
        flex-direction: column;
        gap: 12px;
        align-items: center;
        margin-bottom: 25px;
    }
    
    .difficulty-selector, .theme-selector, .explosion-selector {
        padding: 12px 18px;
        font-size: 15px;
        width: 100%;
        max-width: 300px;
        justify-content: space-between;
    }
    
    .difficulty-selector label, .theme-selector label, .explosion-selector label {
        font-size: 15px;
        min-width: 80px;
    }
    
    .difficulty-selector select, .theme-selector select, .explosion-selector select {
        font-size: 14px;
        padding: 8px 12px;
        flex: 1;
        margin-left: 10px;
    }
    
    .sound-toggle {
        width: 50px;
        height: 50px;
        font-size: 22px;
    }
    
    .info-panel {
        flex-direction: row;
        gap: 15px;
        padding: 12px 20px;
        justify-content: space-between;
        align-items: center;
    }
    
    .mine-counter, .timer {
        flex-direction: column;
        gap: 4px;
        text-align: center;
    }
    
    .counter-label {
        font-size: 12px;
    }
    
    .counter-display {
        font-size: 16px;
        padding: 6px 10px;
        min-width: 45px;
    }
    
    .reset-button {
        width: 45px;
        height: 45px;
    }
    
    .face-icon {
        font-size: 22px;
    }
    
    /* Improved cell sizes for better touch targets */
    .cell {
        width: 32px;
        height: 32px;
        font-size: 14px;
        border-radius: 8px;
        touch-action: manipulation;
    }
    
    .game-board {
        gap: 2px;
        padding: 12px;
    }
    
    /* Better spacing for content sections */
    .game-instructions, .game-stats, .share-section, .related-games {
        margin-bottom: 25px;
        padding: 20px;
    }
    
    .instructions-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .instruction-item {
        padding: 12px;
        font-size: 14px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .stat-item {
        padding: 12px;
        flex-direction: column;
        gap: 5px;
        text-align: center;
    }
    
    .share-buttons {
        flex-direction: column;
        align-items: center;
        gap: 12px;
    }
    
    .share-btn {
        width: 200px;
        padding: 12px 20px;
        font-size: 15px;
    }
    
    .games-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .game-card {
        padding: 15px;
    }
    
    .modal-content {
        margin: 10% auto;
        padding: 25px;
        width: 95%;
    }
    
    .modal-buttons {
        flex-direction: column;
        gap: 10px;
    }
    
    .btn-primary, .btn-secondary {
        width: 100%;
        padding: 12px;
        font-size: 16px;
    }
}

/* Small phones */
@media (max-width: 480px) {
    .game-container {
        padding: 8px;
    }
    
    .game-header h1 {
        font-size: 1.8rem;
        margin-bottom: 5px;
    }
    
    .game-subtitle {
        font-size: 0.9rem;
        margin-bottom: 15px;
    }
    
    .game-controls {
        gap: 10px;
        margin-bottom: 20px;
    }
    
    .difficulty-selector, .theme-selector, .explosion-selector {
        padding: 10px 15px;
        font-size: 14px;
        max-width: 280px;
    }
    
    .difficulty-selector label, .theme-selector label, .explosion-selector label {
        font-size: 14px;
        min-width: 70px;
    }
    
    .difficulty-selector select, .theme-selector select, .explosion-selector select {
        font-size: 13px;
        padding: 6px 10px;
    }
    
    .sound-toggle {
        width: 45px;
        height: 45px;
        font-size: 20px;
    }
    
    .info-panel {
        padding: 10px 15px;
        gap: 10px;
    }
    
    .counter-display {
        font-size: 14px;
        padding: 4px 8px;
        min-width: 40px;
    }
    
    .counter-label {
        font-size: 11px;
    }
    
    .reset-button {
        width: 40px;
        height: 40px;
    }
    
    .face-icon {
        font-size: 20px;
    }
    
    /* Optimized cell sizes for small screens */
    .cell {
        width: 28px;
        height: 28px;
        font-size: 12px;
        border-radius: 6px;
    }
    
    .game-board {
        gap: 1px;
        padding: 10px;
    }
    
    /* Content sections optimization */
    .game-instructions, .game-stats, .share-section, .related-games {
        margin-bottom: 20px;
        padding: 15px;
    }
    
    .game-instructions h3, .game-stats h3, .share-section h3, .related-games h3 {
        font-size: 1.2rem;
        margin-bottom: 15px;
    }
    
    .instruction-item {
        padding: 10px;
        font-size: 13px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .stat-item {
        padding: 10px;
        font-size: 14px;
    }
    
    .share-btn {
        width: 180px;
        padding: 10px 15px;
        font-size: 14px;
    }
    
    .modal-content {
        margin: 5% auto;
        padding: 20px;
        width: 98%;
    }
    
    .modal-content h2 {
        font-size: 1.3rem;
    }
    
    .modal-stats {
        flex-direction: column;
        gap: 10px;
        padding: 10px;
    }
}

/* Expert mode mobile optimizations */
@media (max-width: 768px) {
    .game-board.expert {
        overflow-x: auto;
        overflow-y: hidden;
        max-width: 100vw;
        padding: 8px;
        position: relative;
        /* Custom scrollbar for better UX */
        scrollbar-width: thin;
        scrollbar-color: rgba(255, 255, 255, 0.5) transparent;
    }
    
    .game-board.expert::-webkit-scrollbar {
        height: 6px;
    }
    
    .game-board.expert::-webkit-scrollbar-track {
        background: rgba(255, 255, 255, 0.1);
        border-radius: 3px;
    }
    
    .game-board.expert::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.5);
        border-radius: 3px;
    }
    
    .game-board.expert::-webkit-scrollbar-thumb:hover {
        background: rgba(255, 255, 255, 0.7);
    }
    
    .game-board.expert .cell {
        width: 20px;
        height: 20px;
        font-size: 10px;
        border-radius: 4px;
    }
    
    /* Scroll hint for expert mode */
    .game-board.expert::after {
        content: '← Swipe to scroll →';
        position: absolute;
        bottom: -25px;
        left: 50%;
        transform: translateX(-50%);
        font-size: 12px;
        color: var(--text-accent);
        opacity: 0.7;
        pointer-events: none;
        white-space: nowrap;
    }
}

@media (max-width: 480px) {
    .game-board.expert {
        padding: 6px;
        gap: 1px;
    }
    
    .game-board.expert .cell {
        width: 18px;
        height: 18px;
        font-size: 9px;
        border-radius: 3px;
    }
}

/* Ultra-wide expert mode for landscape orientation */
@media (max-width: 768px) and (orientation: landscape) {
    .game-board.expert {
        max-height: 70vh;
        overflow-y: auto;
    }
    
    .game-board.expert .cell {
        width: 22px;
        height: 22px;
        font-size: 11px;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Performance optimizations for mobile */
    .game-container {
        -webkit-overflow-scrolling: touch;
        transform: translateZ(0); /* Enable hardware acceleration */
    }
    
    .game-board {
        will-change: transform; /* Optimize for animations */
        transform: translateZ(0); /* Enable hardware acceleration */
    }
    
    /* Larger touch targets for all devices */
    .cell {
        min-width: 32px;
        min-height: 32px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        will-change: transform; /* Optimize for touch animations */
    }
    
    /* Remove hover effects on touch devices */
    .cell:hover {
        transform: none;
        box-shadow: var(--shadow-primary);
        filter: none;
    }
    
    .cell:hover::before {
        left: -100%;
    }
    
    /* Enhanced touch feedback */
    .cell:active {
        transform: scale(0.95);
        background: var(--cell-bg);
        box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
        transition: all 0.1s ease;
    }
    
    .cell.revealed:active {
        transform: none;
        background: var(--cell-revealed);
    }
    
    .cell.flagged:active {
        transform: scale(0.95);
        background: var(--cell-flagged);
    }
    
    /* Better button touch targets */
    .reset-button, .sound-toggle {
        min-width: 48px;
        min-height: 48px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }
    
    .reset-button:hover, .sound-toggle:hover {
        transform: none;
    }
    
    .reset-button:active, .sound-toggle:active {
        transform: scale(0.95);
        transition: transform 0.1s ease;
    }
    
    /* Improved select dropdowns for touch */
    .difficulty-selector select, .theme-selector select, .explosion-selector select {
        min-height: 44px;
        touch-action: manipulation;
        -webkit-appearance: none;
        background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
        background-repeat: no-repeat;
        background-position: right 10px center;
        background-size: 16px;
        padding-right: 35px;
    }
    
    /* Modal improvements for touch */
    .modal-content {
        touch-action: manipulation;
    }
    
    .btn-primary, .btn-secondary {
        min-height: 48px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }
    
    .btn-primary:active, .btn-secondary:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }
}

/* Landscape orientation optimizations */
@media (max-width: 768px) and (orientation: landscape) {
    .game-container {
        padding: 5px;
    }
    
    .game-header h1 {
        font-size: 1.5rem;
        margin-bottom: 5px;
    }
    
    .game-subtitle {
        font-size: 0.9rem;
        margin-bottom: 10px;
    }
    
    .game-controls {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
        margin-bottom: 15px;
    }
    
    .difficulty-selector, .theme-selector, .explosion-selector {
        flex: 1;
        min-width: 150px;
        max-width: 200px;
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .info-panel {
        padding: 8px 15px;
        gap: 12px;
    }
    
    .game-instructions, .game-stats, .share-section, .related-games {
        margin-bottom: 15px;
        padding: 15px;
    }
}

/* Very small screens (iPhone SE, etc.) */
@media (max-width: 375px) {
    .cell {
        width: 26px;
        height: 26px;
        font-size: 11px;
    }
    
    .game-board.expert .cell {
        width: 16px;
        height: 16px;
        font-size: 8px;
    }
    
    .counter-display {
        font-size: 12px;
        padding: 3px 6px;
        min-width: 35px;
    }
    
    .reset-button, .sound-toggle {
        width: 38px;
        height: 38px;
    }
    
    .difficulty-selector, .theme-selector, .explosion-selector {
        max-width: 260px;
        padding: 8px 12px;
        font-size: 13px;
    }
} 