body {
    font-family: 'Inter', sans-serif;
    overscroll-behavior: none;
    margin: 0;
    overflow-x: hidden;
}

.sudoku-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
    width: 100%;
    max-width: 400px;
    aspect-ratio: 1 / 1;
    border: 3px solid #374151;
    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;
    font-size: clamp(1rem, 5vw, 2rem);
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out;
    position: relative;
}

.sudoku-cell.selected {
    background-color: #b7d8ff;
    color: white;
}

.sudoku-cell.highlighted-rcb {
    background-color: #e0efff !important;
}

.sudoku-cell.highlighted-num {
    background-color: #bfdbfe !important;
}

.sudoku-cell.selected.highlighted-rcb,
.sudoku-cell.selected.highlighted-num {
    background-color: #b7d8ff !important;
}

.sudoku-cell.prefilled {
    color: #1f2937;
    font-weight: 700;
    cursor: default;
}

.sudoku-cell.user-filled {
    color: #2563eb;
}

.sudoku-cell.error {
    background-color: #fecaca !important;
    color: #dc2626 !important;
}

/* Thicker borders for 2x2 subgrids */
.sudoku-cell:nth-child(2n) {
    border-right-width: 2px;
    border-right-color: #4b5563;
}

.sudoku-cell:nth-child(4n) {
    border-right-width: 1px;
    border-right-color: #d1d5db;
}

.sudoku-grid > .sudoku-cell:nth-child(n+5):nth-child(-n+8) {
    border-bottom-width: 2px;
    border-bottom-color: #4b5563;
}

.sudoku-grid > .sudoku-cell:nth-child(n+13):nth-child(-n+16) {
    border-bottom-width: 1px;
    border-bottom-color: #d1d5db;
}

.sudoku-grid > .sudoku-cell:last-child {
    border-right-width: 0;
}

.sudoku-grid > .sudoku-cell:nth-child(n+13):nth-child(-n+16) {
    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;
    color: white;
}

.controls button.active {
    background-color: #1d4ed8;
}

/* Pencil Marks */
.sudoku-cell .pencil-marks {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 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.6rem, 2vw, 0.9rem);
    color: #6b7280;
    font-weight: 400;
}

.sudoku-cell.has-pencil-marks:not(.user-filled):not(.prefilled) {
    font-size: 0;
}

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;
}
 

/* 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;
}

/* 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;
    color: white;
}

.difficulty-count {
    font-size: 0.75rem;
    margin-left: 4px;
}

.difficulty-link {
    display: inline-block;
    text-decoration: none;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.difficulty-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    background-color: #3b82f6;
    color: white;
}

.difficulty-link.active {
    background-color: #3b82f6;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* 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;
}

#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;
    }
}

/* Mobile-specific styles */
@media (max-width: 640px) {
    #difficulty-dropdown {
        display: block;
        width: 100%;
        margin: 0;
        padding: 0.75rem 2.5rem 0.75rem 0.75rem;
        font-size: 0.875rem;
        background-size: 1.25em;
        min-height: 44px;
        border-radius: 0;
        box-sizing: border-box;
    }
    .difficulty-link {
        display: none;
    }
    .timer-difficulty {
        position: relative;
        z-index: 10;
        width: 100%;
    }
    .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;
        font-size: 0.875rem;
    }
}

/* 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;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out;
}

.calendar-day:hover {
    background-color: #e5e7eb;
}

.calendar-day.today {
    background-color: #f59e0b;
    color: white;
    font-weight: 600;
}

.calendar-day.selected {
    background-color: #3b82f6;
    color: white;
    font-weight: 600;
}

.calendar-day.disabled {
    color: #d1d5db;
    cursor: default;
}

.calendar-day.disabled:hover {
    background-color: transparent;
}

.weekday-label {
    text-align: center;
    font-size: 0.875rem;
    font-weight: 600;
    color: #6b7280;
}

.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%;
        }
}
