:root {
    --color-primary: #01a9c1;
    --color-secondary: #027495;
    --color-white: #ffffff;
}
* {
    -webkit-tap-highlight-color: transparent;
  }

body {
    font-family: Arial, sans-serif;
    margin: 0;
    height: 100vh;
    width: 100vw;
    background-color: #1a1a1aea;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    width: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    border-radius: 15px;
    backdrop-filter: blur(4px);
    max-height: 90vh;
    overflow-y: auto;
    padding-bottom: 2rem;
}

h1 {
    color: var(--color-white);
    font-size: 2.5rem;  
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    margin-bottom: 1rem; 
}


#game-board {
    display: grid;
    gap: 8px;
    padding: 5px;
    backdrop-filter: blur(4px);
    border-radius: 8px;
    width: fit-content;
    margin: 0;
    max-height: 1200px;
    max-width: calc(90vw - 2px); 
    overflow-x: auto; 
    scrollbar-width: normal;
    scrollbar-color: var(--color-secondary) rgba(255, 255, 255, 0.1);
}


#game-board::-webkit-scrollbar {
    width: 12px; 
    height: 12px;
}

#game-board::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
}

#game-board::-webkit-scrollbar-thumb {
    background-color: var(--color-secondary);
    border-radius: 6px;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

#game-board::-webkit-scrollbar-corner {
    background: rgba(255, 255, 255, 0.1);
}

.cell {
    width: 35px;
    height: 35px;
    margin: 0; 
    background: rgba(255, 255, 255, 0.9);
    
    border-radius: 6px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    font-weight: bold;
    font-size: 1em; 
    color: var(--color-secondary);
    position: relative; 
    z-index: 1; 
}

.cell:hover {
    transform: scale(1.01);
}

.cell.revealed {
    background: rgba(255, 255, 255, 0.3);
}

.cell.mine {
    background: #e63946;
    color: white;
}

.back-btn {
    position: fixed;
    top: 20px;
    left: 20px;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    text-decoration: none;
    padding: 0.8rem 1.5rem;
    border-radius: 25px;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(4px);
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

#game-info {
    margin-top: 1rem;  
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;  
}

#restart-button {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 25px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(4px);
}

#restart-button:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

#status {
    color: var(--color-white);
    font-size: 1.2rem;
    padding: 1rem 2rem;
    text-align: center;
    animation: fadeIn 0.5s ease-out;
}


.cell[data-number="1"] { color: #23c7dd; }
.cell[data-number="2"] { color: #1ecf4b; }
.cell[data-number="3"] { color: #fc5a5a; }
.cell[data-number="4"] { color: #4361ee; }
.cell[data-number="5"] { color: #ff9f1c; }
.cell[data-number="6"] { color: #ff758f; }
.cell[data-number="7"] { color: #b5179e; }
.cell[data-number="8"] { color: #480ca8; }

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


@media screen and (max-width: 600px) {
    .container {
        transform: translate(-50%, -40%) scale(0.9);
        padding: 1rem;
    }

    #game-board {
        gap:4px;
    }
    .cell {
        width: 22px;
        height: 22px;
        font-size: 0.9em;
    }

   
    #game-board::-webkit-scrollbar {
        width: 14px; 
        height: 14px;
    }
    .back-btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
        top: 10px;
        left: 10px;
    }
}

.popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease-out;
}

.popup-content {
    background: #1a1a1aea;
    padding: 2.5rem;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    max-width: 400px;
    width: 90%;
    margin: 20px;
    transform: translateY(0);
    animation: slideUp 0.4s ease-out;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color:white;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.8rem;
    color: white;
    font-weight: bold;
    font-size: 1.1rem;
}

.form-group input {
    width: 40%;
    padding: 0.8rem 1rem;
    border: 2px solid #45a049;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.9);
}

.popup-content .form-group input {
    color: #1a1a1a;
}

.form-group input:focus {
    outline: none;
    box-shadow: 0 0 0 2px #4fce56;
}

#startGame {
    background: #45a049;
    color: white;
    padding: 1rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
    font-size: 1.1rem;
    font-weight: bold;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#startGame:hover {
    background: #4fce56;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}