@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600&display=swap');

body {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 100vh;
    margin: 0;
    padding: 2rem 1rem;
    font-family: 'Poppins', sans-serif;
    color: #fafafa;
}

h1 {
    margin: 0;
    /* Remove default margins */
    color: #6c63ff;
    ;
    font-weight: 600;
    font-size: 3rem;
    letter-spacing: 2px;
    text-shadow: 0 0 15px rgba(74, 222, 128, 0.4);
}

@media (max-width: 600px) {
    h1 {
        font-size: 2rem;
    }

    #stats-container>div {
        font-size: 0.9rem;
        padding: 6px 12px;
    }
}

h1 {
    text-shadow: none;
    /* Cleaner look without the glow */
}

#board {
    width: 90vw;
    height: 90vw;
    max-width: 540px;
    max-height: 540px;
    aspect-ratio: 1 / 1;
    /* Ensure the board is always square */
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    border: 2px solid #6c63ff;
    /* Modern purple/blue accent */
    box-shadow: 0 0 8px rgba(108, 99, 255, 0.5);
    /* Softer shadow */
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    /* Ensures canvas corners are rounded */
}

#overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(26, 26, 26, 0.85);
    backdrop-filter: blur(5px);
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    font-size: 2.5rem;
    font-weight: 600;
    visibility: hidden;
}

#overlay.visible {
    visibility: visible;
}

#overlay button {
    font-family: 'Poppins', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    padding: 10px 20px;
    margin-top: 20px;
    border: none;
    border-radius: 8px;
    background-color: #6c63ff;
    color: #a9a3ff;
    ;
    color: #1a1a1a;
    border-color: #444;
    cursor: pointer;
    transition: transform 0.2s, filter 0.2s;
}

#overlay button:hover,
#overlay button:focus {
    transform: scale(1.05);
    filter: brightness(1.1);
    outline: none;
}

#ad-btn-overlay {
    background-color: #4ade80;
    /* A nice green for the ad button */
    color: #1a1a1a;
}

#difficulty-container {
    margin-top: 1.5rem;
    font-size: 1.1rem;
    display: flex; 
    flex-direction: column;
    gap: 0.5rem;
}

.tile {
    width: calc(100% / 9);
    height: calc(100% / 9);
    box-sizing: border-box;
    /* This is the fix */
    border: 1px solid #444;

    /* Text */
    font-weight: bold;
    display: flex;
    justify-content: center;
    align-items: center;
}


.tile-start {
    background-color: #2c2c2e;
    color: #a9a3ff;
    /* Lighter shade of the accent for hints */
}

.tile-selected {
    background-color: #4f46e5;
    /* A more vibrant selection color */
}

#digits-container {
    width: 90vw;
    max-width: 450px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

#digits {
    display: flex;
    justify-content: center;
}

.number {
    width: 10vw;
    height: 10vw;
    max-width: 54px;
    max-height: 54px;
    aspect-ratio: 1 / 1;
    border: 1px solid #6c63ff;
    margin: 1px;
    font-weight: bold;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

.tile,
.number {
    font-family: 'Courier New', Courier, monospace;
    font-size: clamp(20px, 4.5vw, 30px);
    /* Slightly larger responsive font size */
}

.number-selected {
    background-color: #6c63ff;
    color: #1c1c1e;
}

/* Add thicker borders for 3x3 sub-grids */
/* Horizontal lines */
.horizontal-line {
    border-bottom: 2px solid #6c63ff;
}

/* Vertical lines */
.vertical-line {
    border-right: 2px solid #6c63ff;
}

/* Add a red color for incorrect numbers */
.tile-error {
    color: #e57373;
}

#difficulty {
    padding: 8px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 16px;
    background-color: #2c2c2e;
    color: #f5f5f7;
    border: 1px solid #6c63ff;
    border-radius: 5px;
}

.hidden {
    display: none;
}

/* Media query for smaller screens */
@media (max-width: 480px) {
    h1 {
        font-size: 24px;
    }

    #difficulty {
        margin: 10px 0;
    }
}