/* Minesweeper - Classic Puzzle Game */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700&family=Nunito:wght@400;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Nunito', sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    min-height: 100vh;
    color: #fff;
    overflow-x: hidden;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.game-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 10px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.back-btn {
    display: inline-block;
    color: #e94560;
    text-decoration: none;
    font-weight: 600;
    margin-bottom: 10px;
    transition: color 0.3s;
}

.back-btn:hover {
    color: #ff6b6b;
}

/* Header */
.game-header {
    text-align: center;
    margin-bottom: 15px;
}

.game-header h1 {
    font-family: 'Orbitron', sans-serif;
    font-size: 2rem;
    color: #e94560;
    text-shadow: 0 0 20px rgba(233, 69, 96, 0.5);
    letter-spacing: 4px;
}

.stats-bar {
    display: flex;
    justify-content: center;
    gap: 25px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.stat-item {
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 20px;
    border-radius: 10px;
    border: 2px solid #e94560;
}

.stat-item.timer {
    min-width: 100px;
}

.stat-label {
    color: #aaa;
    font-size: 0.7rem;
    margin-right: 5px;
}

.stat-item span:last-child {
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    color: #fff;
}

/* Screens */
.screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
}

.screen.hidden {
    display: none;
}

/* Start Screen */
.mine-art {
    font-size: 5rem;
    margin-bottom: 15px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

#startScreen h2 {
    font-size: 1.3rem;
    color: #e94560;
    margin-bottom: 10px;
}

.instructions {
    color: #aaa;
    margin-bottom: 20px;
    font-size: 0.95rem;
}

/* Difficulty Select */
.difficulty-select {
    margin-bottom: 20px;
}

.difficulty-select h3 {
    color: #e94560;
    margin-bottom: 10px;
    font-size: 1rem;
}

.difficulty-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.diff-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid #555;
    border-radius: 10px;
    padding: 12px 20px;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s;
    min-width: 120px;
}

.diff-btn:hover {
    border-color: #e94560;
    background: rgba(233, 69, 96, 0.2);
}

.diff-btn.active {
    border-color: #e94560;
    background: rgba(233, 69, 96, 0.3);
    box-shadow: 0 0 15px rgba(233, 69, 96, 0.3);
}

.diff-name {
    display: block;
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 3px;
}

.diff-info {
    display: block;
    font-size: 0.75rem;
    color: #aaa;
}

/* High Scores Panel */
.high-scores-panel {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid #e94560;
    border-radius: 10px;
    padding: 15px 25px;
    margin-bottom: 20px;
    min-width: 250px;
}

.high-scores-panel h3 {
    color: #e94560;
    font-size: 1rem;
    margin-bottom: 10px;
}

.best-time-row {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px solid rgba(233, 69, 96, 0.3);
    font-size: 0.9rem;
}

.best-time-row:last-child {
    border-bottom: none;
}

.best-time-row span:first-child {
    color: #aaa;
}

.best-time-row span:last-child {
    color: #4ade80;
    font-weight: 700;
    font-family: 'Orbitron', sans-serif;
}

/* Buttons */
.play-btn {
    background: linear-gradient(135deg, #e94560 0%, #c23a51 100%);
    color: #fff;
    border: none;
    padding: 15px 40px;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: 10px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 2px;
    transition: all 0.3s;
    box-shadow: 0 5px 20px rgba(233, 69, 96, 0.4);
}

.play-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(233, 69, 96, 0.6);
}

.play-btn:active {
    transform: translateY(0);
}

.menu-btn {
    display: inline-block;
    background: transparent;
    color: #e94560;
    border: 2px solid #e94560;
    padding: 12px 25px;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s;
    margin-left: 15px;
}

.menu-btn:hover {
    background: #e94560;
    color: #fff;
}

/* Game Screen */
#gameScreen {
    padding: 10px;
}

.game-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.mode-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid #555;
    border-radius: 10px;
    padding: 10px 20px;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.mode-btn.active {
    border-color: #fbbf24;
    background: rgba(251, 191, 36, 0.2);
}

.mode-icon {
    font-size: 1.2rem;
}

.mode-text {
    font-size: 0.85rem;
}

.restart-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid #e94560;
    border-radius: 10px;
    padding: 10px 20px;
    color: #e94560;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s;
}

.restart-btn:hover {
    background: #e94560;
    color: #fff;
}

/* Game Board */
.game-board {
    display: inline-grid;
    gap: 2px;
    background: #1a1a2e;
    padding: 10px;
    border-radius: 10px;
    border: 3px solid #e94560;
    box-shadow: 0 0 30px rgba(233, 69, 96, 0.2);
    max-width: 100%;
    overflow-x: auto;
}

.cell {
    width: 30px;
    height: 30px;
    background: linear-gradient(145deg, #3a3a5a, #2a2a4a);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    transition: all 0.1s;
    user-select: none;
    -webkit-user-select: none;
}

.cell:hover:not(.revealed) {
    background: linear-gradient(145deg, #4a4a6a, #3a3a5a);
}

.cell:active:not(.revealed) {
    transform: scale(0.95);
}

.cell.revealed {
    background: #16213e;
    cursor: default;
}

.cell.mine {
    background: #e94560;
}

.cell.flagged {
    background: linear-gradient(145deg, #4a4a6a, #3a3a5a);
}

.cell.flagged::after {
    content: '🚩';
    font-size: 1rem;
}

/* Number colors */
.cell.n1 { color: #3b82f6; }
.cell.n2 { color: #22c55e; }
.cell.n3 { color: #ef4444; }
.cell.n4 { color: #8b5cf6; }
.cell.n5 { color: #a855f7; }
.cell.n6 { color: #06b6d4; }
.cell.n7 { color: #f97316; }
.cell.n8 { color: #6b7280; }

/* Game Over Screen */
#gameOverTitle {
    font-family: 'Orbitron', sans-serif;
    font-size: 2rem;
    margin-bottom: 15px;
}

#gameOverTitle.win {
    color: #4ade80;
}

#gameOverTitle.lose {
    color: #e94560;
}

.result-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.final-stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.final-stat {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid #e94560;
    border-radius: 10px;
    padding: 15px 25px;
    min-width: 120px;
}

.final-value {
    display: block;
    font-family: 'Orbitron', sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
    color: #fff;
}

.final-label {
    display: block;
    font-size: 0.8rem;
    color: #aaa;
    margin-top: 5px;
}

/* New Record */
.new-record {
    background: linear-gradient(135deg, rgba(74, 222, 128, 0.2) 0%, rgba(34, 197, 94, 0.2) 100%);
    border: 2px solid #4ade80;
    border-radius: 10px;
    padding: 15px 30px;
    margin-bottom: 25px;
    animation: glow-green 1s ease-in-out infinite;
}

@keyframes glow-green {
    0%, 100% { box-shadow: 0 0 20px rgba(74, 222, 128, 0.3); }
    50% { box-shadow: 0 0 40px rgba(74, 222, 128, 0.6); }
}

.new-record p {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.3rem;
    color: #4ade80;
    letter-spacing: 3px;
}

.game-over-buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

/* Responsive */
@media (max-width: 600px) {
    .game-header h1 {
        font-size: 1.5rem;
    }

    .stats-bar {
        gap: 10px;
    }

    .stat-item {
        padding: 6px 12px;
    }

    .mine-art {
        font-size: 4rem;
    }

    .diff-btn {
        min-width: 100px;
        padding: 10px 15px;
    }

    .cell {
        width: 28px;
        height: 28px;
        font-size: 0.8rem;
    }

    .game-board {
        padding: 8px;
    }

    .game-over-buttons {
        flex-direction: column;
    }

    .menu-btn {
        margin-left: 0;
    }
}

@media (max-width: 400px) {
    .cell {
        width: 24px;
        height: 24px;
        font-size: 0.7rem;
    }
}
