body {
    font-family: 'Comic Sans MS', cursive, sans-serif;
    background: #FEFBE3;
    color: #4e342e;
    text-align: center;
    margin: 0;
    padding: 0;
}

h1 {
    font-size: 3rem;
    margin-top: 30px;
    color: #d84315;
    text-shadow: 2px 2px #ffe0b2;
}


/* ==== Grid Controls Styling ==== */

#grid-controls {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

#grid-controls label {
    font-weight: 600;
    font-size: 1.1rem;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #6d4c41;
}

#grid-controls input {
    width: 60px;
    padding: 6px;
    border-radius: 8px;
    border: 2px solid #ffab91;
    text-align: center;
    font-weight: bold;
}


/* ==== Board and Cell Styling ==== */

#board {
    display: grid;
    gap: 5px;
    justify-content: center;
}

.cell {
    width: 60px;
    height: 60px;
    border: 2px solid #FEFBE3;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    cursor: pointer;
    border-radius: 12px;
    transition: transform 0.2s ease;
}

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

.cell.normal-mithai {
    background-image: url('laddoo.png');
}

.cell.spoiled {
    background-image: url('moldy mitthai.png');
}

.cell.removed {
    visibility: hidden;
}


/* ==== Buttons ==== */

button {
    margin-top: 10px;
    padding: 12px 25px;
    font-size: 1rem;
    background-color: #ff8a65;
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    transition: background 0.3s ease, transform 0.2s;
}

button:hover {
    background-color: #ff7043;
    transform: scale(1.05);
}

#player-turn {
    font-size: 20px;
    margin-bottom: 15px;
    font-weight: bold;
    color: #5d4037;
}


/* ==== Result Box ==== */

#result {
    position: fixed;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #ffe0b3;
    padding: 30px 40px;
    border-radius: 10px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    font-size: 26px;
    font-weight: bold;
    color: #b30000;
    z-index: 1000;
    display: none;
    text-align: center;
    animation: popIn 0.4s ease-out forwards;
}

@keyframes popIn {
    0% {
        transform: translate(-50%, -60%) scale(0.8);
        opacity: 0;
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

#result.show {
    display: block !important;
}

.hidden {
    display: none;
}


/* === Rules Button === */

#rules-button {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: #ffd54f;
    padding: 10px 18px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 2000;
    transition: transform 0.2s ease;
}

#rules-button:hover {
    transform: scale(1.05);
}


/* === Rules Popup === */

#rules-popup {
    position: fixed;
    top: 80px;
    right: 20px;
    background-color: #fff8e1;
    padding: 25px 30px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    max-width: 320px;
    width: 300px;
    z-index: 3000;
    display: none;
    text-align: left;
}

#rules-popup h2 {
    margin-top: 0;
    color: #d84315;
}

#rules-popup p {
    font-size: 1rem;
    margin: 10px 0;
    color: #4e342e;
}

#rules-popup .popup-content {
    position: relative;
}

#close-rules {
    position: absolute;
    top: -10px;
    right: -10px;
    font-size: 24px;
    cursor: pointer;
    background: #ffccbc;
    padding: 2px 8px;
    border-radius: 50%;
}

#rules-popup.show {
    display: block;
}