:root {
    --bg-main: #f0f2f5;
    --bg-body: #fff;
    --color-txt: #000;
    --filled-color: #000;
    --filled-bg: #caf0f8;

    --cell-highlight-bg: #fff1c2;
    --cell-hover-bg: #ff9214;
    --cell-selected-bg: #bcc3ff;
    --cell-red: #ff72a1;

    --white: #fff;
    --blue: #00aeef;
    --dark-blue: #008dc0;
    --red: #e91e63;
    --black: #000;

    --btn-blue: #00aeef;
    --btn-blue-hover: #058dbe;

    --btn-grey: #f0f2f5;
    --btn-grey-hover: #e1e2e2;

    --btn-red: #e91e63;
    --btn-red-hover: #b92456;

    --nav-size: 70px;
    --sudoku-cell-size: 50px;
    --sudoku-cell-size-sm: 40px;
    --sudoku-cell-size-xs: 35px;

    --border-radius: 8px;

    --space-y: 20px;

    --gap: 5px;

    --font-size-xs: 0.7rem;
    --font-size-sm: 1rem;
    --font-size: 1.5rem;
    --font-size-lg: 2rem;
    --font-size-xl: 3rem;
}

.dark {
    --bg-main: #2a2a38;
    --bg-body: #1a1a2e;
    --color-txt: #bebebe;
    --filled-color: #878790;
    --filled-bg: #000;

    --btn-grey: #2a2a38;
    --btn-grey-hover: #4e4e58;

    --btn-blue: #166380;
    --btn-blue-hover: #277794;

    --btn-red: #791d3c;
    --btn-red-hover: #992f52;

    --cell-highlight-bg: #d8c37e;
    --cell-hover-bg: #c08b49;
    --cell-selected-bg: #4953ac;
}

* {
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: "Montserrat", cursive;
    /* height: 100vh; */
    background-color: var(--bg-body);
    overflow-x: hidden;
    user-select: none;
}

/* input {
    font-family: "Montserrat", cursive;
    border: 2px solid var(--bg-main);
    color: var(--color-txt);
} */

/* input:hover,
input:focus {
    border-color: var(--blue);
} */

a {
    text-decoration: none;
    color: unset;
}

ul {
    list-style-type: none;
}

nav {
    background-color: var(--bg-body);
    color: var(--color-txt);
    position: fixed;
    top: 0;
    width: 100%;
    box-shadow: 5px 2px var(--bg-main);
    z-index: 99;
}

.nav-container {
    max-width: 1280px;
    margin: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    height: var(--nav-size);
}

.nav-logo {
    font-size: var(--font-size-lg);
}

.nav-logo-365 {
    color: var(--dark-blue);
}

.nav-logo-sudoku {
    font-weight: bold;
    color: var(--blue);
}

.dark-mode-toggle {
    color: var(--blue);
    font-size: var(--font-size-lg);
    cursor: pointer;
}

.bxs-sun {
    display: none;
}

.bxs-moon {
    display: inline-block;
}

.dark .bxs-sun {
    display: inline-block;
}

.dark .bxs-moon {
    display: none;
}

.main {
    /* height: 100vh; */
    padding-top: var(--nav-size);
    display: grid;
    place-items: center;
}

/* .screen {
    position: relative;
    overflow: hidden;
    height: 100%;
    max-width: 100%;
    width: 100%;
} */

.btn {
    /* height: 80px; */
    /* Make it responsive */
    /* width: 90%; */
    /* Prevent it from being too large */
    /* max-width: 280px; */
    /* Ensures usability on small screens */
    /* min-width: 150px; */
    background-color: var(--btn-grey);
    color: var(--color-txt);
    border-radius: var(--border-radius);
    display: grid;
    place-items: center;
    transition: width 0.3s ease-in-out;
    overflow: hidden;
    font-size: var(--font-size);
    cursor: pointer;
    padding: 10px;
    margin: 10px;
}

.btn:hover {
    background-color: var(--btn-grey-hover);
}

.btn-blue {
    background-color: var(--btn-blue);
    color: var(--white);
}

.btn-blue:hover {
    background-color: var(--btn-blue-hover);
}

.main-game {
    display: flex;
    flex-direction: column;
    height: 100%;
    flex-direction: row; /* Change from column to row */
    justify-content: center;
    align-items: flex-start;
    gap: 20px; /* Add spacing between elements */
    padding: 30px 10px;
    flex-wrap: wrap; /* Ensures proper wrapping on smaller screens */
}

/* Container to hold left-side elements */
.main-game-right {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.main-sudoku-grid {
    display: grid;
    gap: 0;
    grid-template-columns: repeat(9, 1fr);
    grid-template-rows: repeat(9, 1fr);
    width: fit-content;
    border: 2px solid #7d98b3; 
}

.main-grid-cell {
    height: var(--sudoku-cell-size);
    width: var(--sudoku-cell-size);
    /* border-radius: var(--border-radius); */
    background-color: var(--bg-main);
    color: var(--blue);
    display: grid;
    place-items: center;
    font-size: var(--font-size);
    cursor: pointer;
    border: 1px solid #b8cde0; 
}

/* Add thick right border to separate 3×3 sections */
.main-grid-cell:nth-child(3n) {
    border-right: 2px solid #7d98b3;
}

.main-grid-cell:nth-child(9n) {
    border-right: none; /* Prevent extra thick border at the end of rows */
}

/* Add thick bottom border to separate 3×3 sections */
.main-grid-cell:nth-child(n + 19):nth-child(-n + 27),
.main-grid-cell:nth-child(n + 46):nth-child(-n + 54) {
    border-bottom: 2px solid #7d98b3;
}

.main-grid-cell.filled {
    background-color: var(--filled-bg);
    color: var(--filled-color);
}

/* .main-grid-cell:hover {
    border: 2px solid var(--blue);
    background-color: var(--cell-hover-bg);
} */

/* .main-grid-cell.hover {
    background-color: var(--cell-highlight-bg);
} */

.main-grid-cell.selected {
    background-color: var(--cell-selected-bg);
    color: var(--white);
}

.main-grid-cell.err {
    background-color: var(--cell-red);
    color: var(--white);
}

/* .main-game-info {
    margin-top: var(--space-y);
    margin-bottom: 10px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
} */

/* .main-game-info-box {
    height: 45px;
    background-color: var(--bg-main);
    color: var(--color-txt);
    border-radius: var(--border-radius);
    display: grid;
    place-items: center;
    padding: 0 20px;
    font-size: var(--font-size);
} */

/* .main-game-info-time {
    position: relative;
    align-items: center;
    justify-content: center;
    padding-left: 2rem;
    margin-bottom: auto;
} */

.pause-btn {
    /* position: absolute; */
    right: 10px;
    height: 30px;
    /* width: 30px; */
    border-radius: var(--border-radius);
    background-color: var(--btn-grey);
/*    color: var(--white);*/
    font-size: var(--font-size);
    display: grid;
    place-items: center;
    cursor: pointer;
}

.pause-btn:hover {
    background-color: var(--btn-grey-hover);
}

.main-game-info {
    width: 100%;
    max-width: 200px; /* Prevent elements from being too wide */
    text-align: center;
}

.main-game-info-time {
    /* width: 100%; */
    position: relative;
    align-items: center;
    justify-content: center;
    /* padding-left: 2rem; */
    margin-bottom: auto;
}

.numbers {
    width: 100%;
    max-width: 250px; /* Increase max width */
    text-align: center;
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 3 columns for larger screens */
    gap: 8px;
    padding: 10px;
}

.number, .delete {
    height: 60px; /* Increase height */
    width: 60px; /* Ensure uniform size */
    border-radius: 8px; /* Slight rounding */
    background-color: var(--btn-grey);
    color: var(--color-txt);
    display: grid;
    place-items: center;
    font-size: var(--font-size-lg); /* Larger font */
    cursor: pointer;
    font-weight: bold; /* Make numbers stand out */
}

.number:hover {
    background-color: var(--btn-grey-hover);
}

/* difficulty-selector START */
.difficulty-selector {
    display: flex;
    gap: 5px;
    justify-content: center;
    width: 100%;
/*    margin-bottom: 20px;*/
}

.difficulty-label {
    text-decoration: none;
    color: var(--color-txt);
    font-size: var(--font-size-xs);
    padding: 5px 10px;
/*    border-radius: var(--border-radius);*/
/*    background-color: var(--bg-main);*/
    cursor: pointer;
/*    transition: background-color 0.3s ease-in-out;*/
}

.difficulty-option {
    text-decoration: none;
    color: var(--color-txt);
    font-size: var(--font-size-xs);
    padding: 5px 10px;
    border-radius: var(--border-radius);
/*    background-color: var(--bg-main);*/
    cursor: pointer;
/*    transition: background-color 0.3s ease-in-out;*/
}

/* .difficulty-option:hover {
    background-color: var(--cell-hover-bg);
    color: var(--white);
} */

.difficulty-option.active {
    background-color: var(--cell-selected-bg);
    color: var(--white);
}

/* difficulty-selector END  */

/* Style for delete button */
.delete {
    background-color: var(--btn-red);
    color: var(--white);
}

.delete:hover {
    background-color: var(--btn-red-hover);
}

.result-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-body);
    align-items: center;
    justify-content: center;
    flex-direction: column;
    display: none;
}

.result-screen.active {
    display: flex;
}

.result-screen > * + * {
    margin-top: 20px;
}

.result-screen.active div {
    animation: zoom-in 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.result-screen .congrate {
    font-size: var(--font-size-xl);
    color: var(--blue);
}

.result-screen .info {
    color: var(--color-txt);
    font-size: var(--font-size);
}

#result-time {
    color: var(--blue);
    font-size: var(--font-size-xl);
}


/* FAQ  start*/
.faq {
    margin-top: 40px;
    padding: 20px;
    text-align: center;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.faq h2 {
    font-size: var(--font-size-lg);
    color: var(--color-txt);
    margin-bottom: 30px;
}

.faq-item {
    margin-bottom: 30px;
}

.faq-item h3 {
    font-size: var(--font-size-md);
    color: var(--color-txt);
    margin-bottom: 5px;
}

.faq-item p,
.faq-item ul {
    font-size: var(--font-size-md);
    color: var(--color-txt);
    margin: 0 auto;
    padding-left: 0;
    max-width: 500px;
}

.faq-item ul {
    list-style-type: none;
    padding: 0;
}

.faq-item ul li::before {
    /* content: "✔";  */
    color: var(--blue);
    margin-right: 8px;
}

/* .dark .faq {
    background: var(--bg-body);
    box-shadow: 0 2px 10px rgba(255, 255, 255, 0.1);
} */

.dark .faq-item h3,
.dark .faq-item p,
.dark .faq-item ul {
    color: var(--color-txt);
}
/* FAQ end */

.zoom-in {
    animation: zoom-in 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes zoom-in {
    0% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

.cell-err {
    animation: zoom-out-shake 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes zoom-out-shake {
    0% {
        transform: scale(1.2);
    }
    25% {
        transform: scale(1.2) rotate(10deg);
    }
    50% {
        transform: scale(1.2) rotate(-10deg);
    }
    100% {
        transform: scale(1);
    }
}

@media only screen and (max-width: 800px) {
    .main-game {
        display: flex;
        flex-direction: column; /* Default flex direction */
        align-items: center;
        justify-content: center;
        width: 100%;
        overflow: hidden;
    }

    .main-sudoku-grid {
        order: 1; /* Ensure it appears first */
        /* Ensure it never exceeds screen width */
        /* width: min(100%, 450px);  */
        max-width: 100%;
        overflow: hidden;
    }

    .numbers {
        /* order: 2; */
        display: flex;
        justify-content: center; /* Keep numbers centered */
        flex-wrap: nowrap;
        width: 100%;
        max-width: 400px;
        padding: 10px 0;
        overflow: hidden;
        gap: 5px;
    }

    .number, .delete {
        height: 45px; /* Set equal height */
        width: 45px;  /* Set equal width */
        font-size: var(--font-size);
        flex: 0 1 auto;
        background-color: var(--btn-grey);
        text-align: center;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 8px; /* Slight rounding */
    }

    .delete {
        background-color: var(--red);
        color: var(--white);
    }

    .main-game-right {
        order: 3; /* Appears last */
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }

    .main-grid-cell {
        height: var(--sudoku-cell-size-sm);
        width: var(--sudoku-cell-size-sm);
    }
}


/* Additional adjustments for 360px width */
@media only screen and (max-width: 400px) {
    .main-grid-cell {
        height: var(--sudoku-cell-size-xs);
        width: var(--sudoku-cell-size-xs);
    }
}