body {
    font-family: 'Inter', sans-serif;
    overscroll-behavior: none;
    margin: 0; /* Ensure no default margins cause scrollbars */
    overflow-x: hidden; /* Prevent horizontal scroll */
}
.sudoku-grid {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    grid-template-rows: repeat(9, 1fr);
    width: 100%;
    max-width: 500px; /* Max width for larger screens */
    aspect-ratio: 1 / 1; /* Maintain square shape */
    border: 3px solid #374151; /* dark-gray-700 */
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
.sudoku-cell {
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid #d1d5db; /* gray-300 */
    font-size: clamp(0.75rem, 4vw, 1.75rem); /* Responsive font size */
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out;
    position: relative;
}
.sudoku-cell.selected {
    background-color: #b7d8ff; /* blue-400 */
    color: white;
}
.sudoku-cell.highlighted-rcb { /* Row, Column, Block highlight */
    background-color: #e0efff !important; /* blue-300 */
}
.sudoku-cell.highlighted-num { /* Same number highlight */
    background-color: #bfdbfe !important; /* blue-200 */
}
.sudoku-cell.selected.highlighted-rcb,
.sudoku-cell.selected.highlighted-num {
     background-color: #b7d8ff !important; /* blue-400 for selected cell itself */
}
.sudoku-cell.prefilled {
    color: #1f2937; /* gray-800 */
    font-weight: 700;
    cursor: default;
}
.sudoku-cell.user-filled {
    color: #2563eb; /* blue-600 */
}
.sudoku-cell.error {
    background-color: #fecaca !important; /* red-200 */
    color: #dc2626 !important; /* red-600 */
}
/* Add thicker borders for 3x3 subgrids */
.sudoku-cell:nth-child(3n) {
    border-right-width: 2px;
    border-right-color: #4b5563; /* gray-600 */
}
.sudoku-cell:nth-child(9n) {
    border-right-width: 1px; /* Reset for the last cell in a row */
    border-right-color: #d1d5db;
}
/* Rows */
.sudoku-grid > .sudoku-cell:nth-child(n+19):nth-child(-n+27),
.sudoku-grid > .sudoku-cell:nth-child(n+46):nth-child(-n+54) {
    border-bottom-width: 2px;
    border-bottom-color: #4b5563; /* gray-600 */
}
/* Ensure the last row's cells don't have an extra thick bottom border */
.sudoku-grid > .sudoku-cell:nth-child(n+73):nth-child(-n+81) {
     border-bottom-width: 1px;
     border-bottom-color: #d1d5db;
}
/* Correct right border for the very last cell */
.sudoku-grid > .sudoku-cell:last-child {
    border-right-width: 0;
}
/* Correct bottom border for the last row */
.sudoku-grid > .sudoku-cell:nth-child(n+73):nth-child(-n+81):not(:nth-child(3n)) {
    border-bottom-width: 0;
}
.sudoku-grid > .sudoku-cell:nth-child(n+73):nth-child(-n+81):nth-child(3n) {
    border-bottom-width: 0;
}
.number-palette button, .controls button {
    transition: all 0.2s ease-in-out;
}
.number-palette button:hover, .controls button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}
.number-palette button.active-tool {
    background-color: #3b82f6; /* blue-500 */
    color: white;
}
.controls button.active {
    background-color: #1d4ed8; /* blue-700 */
}
/* Pencil Marks */
.sudoku-cell .pencil-marks {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}
.sudoku-cell .pencil-mark {
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: clamp(0.5rem, 1.5vw, 0.75rem); /* Smaller font for pencil marks */
    color: #6b7280; /* gray-500 */
    font-weight: 400;
}
.sudoku-cell.has-pencil-marks:not(.user-filled):not(.prefilled) {
    font-size: 0; /* Hide main number if only pencil marks are present */
}
/* Blink Animation for Hinted Cells */
@keyframes blink {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}
.sudoku-cell.blink {
    background: #98ffc8 !important;
    animation: blink 1s ease-in-out 1;
}

h1 { font-size: 30px !important; }
h2 { font-size: 23px !important; }
h3 { font-size: 18px !important; }

h1,h2,h3 {
    margin-bottom: 10px;
    margin-top: 20px;
}
 
#overview-section {
    line-height: 1.9;
}
 


/* Modal for messages */
.modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
    justify-content: center;
    align-items: center;
}
.modal-content {
    background-color: #fefefe;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 400px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
}
.modal-close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}
.modal-close:hover,
.modal-close:focus {
    color: black;
    text-decoration: none;
}
/* Win Popup Styles */
@keyframes confetti {
    0% { transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(360deg); opacity: 0; }
}
.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background-color: #f00;
    animation: confetti 3s linear forwards;
}
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}
.pulse {
    animation: pulse 1.5s infinite;
}
@keyframes slideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.slide-in {
    animation: slideIn 0.5s ease-out forwards;
}
.popup-overlay {
    background-color: rgba(0, 0, 0, 0.7);
}
.star-rating i {
    color: #FFD700;
    text-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
}
.difficulty-btn {
    transition: all 0.2s ease-in-out;
}
.difficulty-btn.active {
    background-color: #3b82f6; /* blue-500 */
    color: white;
}
.difficulty-count {
    font-size: 0.75rem;
    margin-left: 4px;
}
.difficulty-link {
    display: inline-block; /* Ensure <a> behaves like a button */
    text-decoration: none; /* Remove underline from links */
    transition: all 0.2s ease-in-out; /* Smooth transition for all properties */
    box-shadow: 0 2px 4px rgba(0,0,0,0.1); /* Subtle default shadow */
}

.difficulty-link:hover {
    transform: translateY(-2px); /* Lift effect on hover */
    box-shadow: 0 4px 8px rgba(0,0,0,0.15); /* Enhanced shadow on hover */
    background-color: #3b82f6; /* blue-500 */
    color: white;
}

.difficulty-link.active {
    background-color: #3b82f6; /* blue-500 */
    color: white;
    transform: translateY(-1px); /* Slight lift for active state */
    box-shadow: 0 4px 8px rgba(0,0,0,0.15); /* Match hover shadow */
}
/* Dropdown styling */
#difficulty-dropdown {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg fill='gray' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/><path d='M0 0h24v24H0z' fill='none'/></svg>");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 1.5em;
    padding: 0.5rem 2rem 0.5rem 0.5rem;
    font-size: 1rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    cursor: pointer;
    touch-action: manipulation;
    display: none; /* Hidden by default (shown on mobile) */
}

#difficulty-dropdown:focus {
    outline: none;
    box-shadow: 0 0 0 2px #3b82f6;
    border-color: #3b82f6;
}
.right-sidebar {
    width: 100%;
    max-width: 320px;
    background: #eaf4ff;
    margin-left: 15px;
    padding: 10px 10px 10px 10px;
    position: sticky;
    top: 0;
}
@media (min-width: 641px) {
    
     #difficulty-dropdown {
        display: block; /* Show dropdown on mobile */
        margin: 0;
        padding: 0.75rem 2.5rem 0.75rem 0.75rem;
        font-size: 0.875rem;
        background-size: 1.25em;
        min-height: 44px; /* Touch-friendly height */
        border-radius: 0; /* Remove border radius for full-width look */
        box-sizing: border-box; /* Ensure padding is included in width */
    }
    .difficulty-link {
        display: inline-block; /* Show difficulty links */
    }
}

/* Mobile-specific styles */
@media (max-width: 640px) {
    #difficulty-dropdown {
        display: block; /* Show dropdown on mobile */
        width: 50vw; /* Full screen width */
        margin: 0;
        padding: 0.75rem 2.5rem 0.75rem 0.75rem;
        font-size: 0.875rem;
        background-size: 1.25em;
        min-height: 44px; /* Touch-friendly height */
        border-radius: 0; /* Remove border radius for full-width look */
        box-sizing: border-box; /* Ensure padding is included in width */
    }
    .difficulty-link {
        display: none; /* Hide difficulty links on mobile */
     } 
    .timer-difficulty {
        position: relative;
        z-index: 10;
        width: 100%; /* Ensure container is full-width */
    }
}
#difficulty-dropdown:focus {
    outline: none;
    box-shadow: 0 0 0 2px #3b82f6;
}
#difficulty-dropdown option {
    background-color: #fff;
    color: #374151;
}
/* Small screen adjustments */
@media (max-width: 640px) {
    .sudoku-grid {
        max-width: 95vw;
    }
    .number-palette {
        gap: 0.25rem;
    }
    .number-palette button {
        padding: 0.5rem;
        font-size: 0.875rem;
    }
    .controls button {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }
    .timer-difficulty {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: space-between;
        align-items: center;
        gap: 0.5rem;
    }
    .difficulty-link {
        padding: 0.5rem 0.75rem; /* Slightly smaller padding */
        font-size: 0.875rem; /* Smaller font size */
    }
}
/* Calendar Styles */
#challenges-section {
    max-width: 600px;
}
#calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.5rem;
}
.calendar-day {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    font-size: 1rem;
    font-weight: 500;
    color: #374151; /* gray-700 */
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out;
}
.calendar-day:hover {
    background-color: #e5e7eb; /* gray-200 */
}
.calendar-day.today {
    background-color: #f59e0b; /* amber-500 */
    color: white;
    font-weight: 600;
}
.calendar-day.selected {
    background-color: #3b82f6; /* blue-500 */
    color: white;
    font-weight: 600;
}
.calendar-day.disabled {
    color: #d1d5db; /* gray-300 */
    cursor: default;
}
.calendar-day.disabled:hover {
    background-color: transparent;
}
/* Weekday Labels */
.weekday-label {
    text-align: center;
    font-size: 0.875rem;
    font-weight: 600;
    color: #6b7280; /* gray-500 */
}
.timer-difficulty {
    position: relative;
    z-index: 10;
}
 .toggle-btn {
    position: relative;
    padding-left: 2.5rem;
    font-weight: bold;
    
  }

  /* BEFORE: shows + icon by default */
  .toggle-btn::before {
    content: '+';
    position: absolute;
    left: 5.3rem;
    top: 50%;
    transform: translateY(-50%) rotate(0deg);
    transition: transform 0.3s ease;
    background-color: #0ea5e9;
    color: white;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 9999px;
    text-align: center;
    line-height: 1.5rem;
    font-size: 1.1rem;
    font-weight: bold;
  }

  /* Rotate to make it look like − */
  .toggle-btn.expanded::before {
    transform: translateY(-50%) rotate(45deg); /* makes + look like - */
  }

  /* Optional after element for extra effect */
  .toggle-btn::after {
    content: '';
    display: none;
  }
@media screen and (max-width:900px) {
   
    .right-sidebar {
        max-width: 100%;
        margin: 10px auto 0 auto;
    }
    .game-section {
        flex-direction: column;
    }
        div#easy-container {
    flex-direction: column;
    }
    div#medium-container {
    flex-direction: column;
    }
    div#hard-container {
    flex-direction: column;
    }
    div#expert-container {
    flex-direction: column;
    }
    div#master-container {
    flex-direction: column;
    }
    div#extreme-container {
    flex-direction: column;
    }
}


@media screen and (max-width:600px) {

    .controls {flex-wrap: wrap;gap: 0 !important;}

        .controls button {
            width: 32.33%;
            margin: 1% 0.5%;
        }
        

        .controls button:nth-child(4),.controls button:nth-child(5) {
            width: 49%;
        }
}
