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

html, body {
    width: 100%;
    height: 100%;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 10px;
}

.container {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 1000px;
    width: 100%;
}

.header {
    text-align: center;
    margin-bottom: 25px;
}

.header h1 {
    font-size: 2.5em;
    color: #333;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
    align-items: center;
}

.difficulty-selector {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.difficulty-selector label {
    font-weight: 600;
    color: #555;
    font-size: 0.9em;
}

.difficulty-selector select,
#width, #height, #mines {
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 1em;
    transition: border-color 0.3s;
}

.difficulty-selector select:focus,
#width:focus, #height:focus, #mines:focus {
    outline: none;
    border-color: #667eea;
}

.custom-settings {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    align-items: center;
}

.custom-settings label {
    font-size: 0.85em;
    color: #555;
    font-weight: 600;
}

.custom-settings input {
    width: 100%;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f0f0f0;
    color: #333;
    border: 2px solid #ddd;
}

.btn-secondary:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.btn-secondary.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.settings-row {
    display: flex;
    gap: 15px;
    align-items: center;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 500;
    color: #555;
}

.checkbox-label input {
    cursor: pointer;
    width: 18px;
    height: 18px;
}

.checkbox-label span {
    user-select: none;
}

.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 20px;
    background: #f9f9f9;
    padding: 15px;
    border-radius: 8px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.stat-item .label {
    font-size: 0.85em;
    color: #999;
    font-weight: 600;
    text-transform: uppercase;
}

.stat-item .value {
    font-size: 1.5em;
    font-weight: 700;
    color: #333;
    border-radius: 4px;
    padding: 4px 8px;
}

.status-ready {
    background: #e3f2fd;
    color: #1976d2;
}

.status-playing {
    background: #fff3cd;
    color: #856404;
}

.status-won {
    background: #d4edda !important;
    color: #155724 !important;
}

.status-lost {
    background: #f8d7da !important;
    color: #721c24 !important;
}

.streak-display {
    text-align: center;
    margin-bottom: 20px;
    padding: 15px;
    background: linear-gradient(135deg, #ff6b6b 0%, #ffd93d 100%);
    border-radius: 8px;
    animation: pulseIn 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

.streak-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-weight: 700;
    color: white;
    font-size: 1.3em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.streak-label {
    font-size: 1.1em;
}

.streak-counter {
    font-size: 1.8em;
    background: rgba(255, 255, 255, 0.3);
    padding: 5px 12px;
    border-radius: 4px;
    min-width: 50px;
}

.streak-multiplier {
    font-size: 1.4em;
    animation: bounce 0.6s infinite;
    background: rgba(255, 255, 255, 0.3);
    padding: 5px 10px;
    border-radius: 4px;
    min-width: 45px;
}

@keyframes pulseIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

.game-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.game-board {
    display: inline-grid;
    gap: 2px;
    padding: 10px;
    background: #ccc;
    border-radius: 8px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3), 0 5px 15px rgba(0, 0, 0, 0.2);
}

.cell {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #e8e8e8, #d0d0d0);
    border: 2px solid #999;
    border-top-color: #fff;
    border-left-color: #fff;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.95em;
    user-select: none;
    transition: all 0.1s;
    position: relative;
    overflow: hidden;
    touch-action: none;
}

.cell:active:not(.revealed) {
    border-style: inset;
}

.cell.revealed {
    background: linear-gradient(145deg, #c0c0c0, #d8d8d8);
    border-top-color: #888;
    border-left-color: #888;
    border-bottom-color: #fff;
    border-right-color: #fff;
    cursor: default;
}

.cell.revealed.empty {
    background: #c0c0c0;
}

.cell.mine {
    background: linear-gradient(145deg, #300, #500);
    color: #fff;
}

.cell.flagged {
    background: linear-gradient(145deg, #ffeb3b, #fbc02d);
    font-size: 1.2em;
    color: #d32f2f;
}

.cell.number-1 { color: #0000ff; }
.cell.number-2 { color: #008000; }
.cell.number-3 { color: #ff0000; }
.cell.number-4 { color: #000080; }
.cell.number-5 { color: #800000; }
.cell.number-6 { color: #008080; }
.cell.number-7 { color: #000000; }
.cell.number-8 { color: #808080; }

.cell.exploded {
    background: #ff4444;
    animation: explodeCell 0.5s ease-out;
}

@keyframes explodeCell {
    0% {
        transform: scale(1);
        background: #ffff00;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        background: #ff4444;
    }
}

.feature-info {
    background: #f0f7ff;
    border: 2px solid #667eea;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    color: #333;
    font-size: 0.95em;
    line-height: 1.6;
}

.feature-info strong {
    color: #667eea;
}

.feature-info p {
    margin: 8px 0;
}

.feature-info em {
    color: #764ba2;
    font-style: italic;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .container {
        padding: 20px;
    }

    .header h1 {
        font-size: 2em;
    }

    .controls {
        grid-template-columns: 1fr;
    }

    .custom-settings {
        grid-template-columns: repeat(2, 1fr);
    }

    .stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        padding: 10px;
    }

    .stat-item .value {
        font-size: 1.2em;
    }

    .cell {
        width: 35px;
        height: 35px;
        font-size: 0.85em;
    }

    .feature-info {
        font-size: 0.85em;
        padding: 10px;
    }

    .streak-info {
        font-size: 1.1em;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 15px;
    }

    .header h1 {
        font-size: 1.5em;
    }

    .btn {
        padding: 10px 16px;
        font-size: 0.9em;
    }

    .stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        padding: 8px;
    }

    .stat-item .label {
        font-size: 0.7em;
    }

    .stat-item .value {
        font-size: 1em;
    }

    .cell {
        width: 30px;
        height: 30px;
        font-size: 0.75em;
    }

    .game-board {
        gap: 1px;
        padding: 5px;
    }

    .feature-info {
        font-size: 0.75em;
        padding: 8px;
    }

    .streak-info {
        font-size: 0.95em;
        gap: 5px;
    }

    .streak-counter,
    .streak-multiplier {
        font-size: 1.2em;
        padding: 3px 6px;
    }

    .settings-row {
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }

    .btn {
        width: 100%;
    }
}
