/* General styles */
:root{
    --cell-size: calc(22rem/ 9);
}
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    background-color: #f9f9f9;
    color: #333;
}
nav{
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

header {
    background-color: #ffffff;
    border-bottom: 1px solid #ddd;
    padding: 10px 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
}

header h1 {
    font-size: 1.5em;
    margin: 0;
}

header button {
    background-color: #007bff;
    color: #fff;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
}

header button:hover {
    background-color: #0056b3;
}

/* Game info section */
#game-info {
    background-color: #ffffff;
    border-bottom: 1px solid #ddd;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

#game-info span {
    display: block;
    font-size: 0.9em;
}

#game-info #mistake-count {
    font-weight: bold;
    color: #d9534f;
}

#game-info #time-count {
    font-weight: bold;
}

#pause-button {
    background: none;
    border: none;
    font-size: 1.2em;
    cursor: pointer;
}

/* Game board */
sudoku-board {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 2px;
    margin: 20px auto;
    max-width: calc((var(--cell-size) + 2px) * 9 + 2px);
    background-color: #ddd;
    border: 2px solid #333;
}
.sudoku-cell {
    display: flex;
    justify-content: center; /* Centers horizontally */
    align-items: center;   /* Centers vertically */
    background-color: #ffffff;
    text-align: center;
    line-height: 2;
    font-size: 1.2em;
    width: var(--cell-size);
    height: var(--cell-size);
}
.sudoku-cell--filled {
    background-color: #f0f0f0;
    color: #888;
    cursor: not-allowed;
}

.sudoku-cell:nth-child(3n) {
    border-right: 2px solid #333;
}
.sudoku-cell.selected {
    background-color: #ABE0F0;
}
.sudoku-cell--row__selected {
    background-color: #D3F1F9;
}
.sudoku-cell--col__selected {
    background-color: #D3F1F9;
}
.sudoku-cell:nth-child(19),
.sudoku-cell:nth-child(20),
.sudoku-cell:nth-child(21),
.sudoku-cell:nth-child(22),
.sudoku-cell:nth-child(23),
.sudoku-cell:nth-child(24),
.sudoku-cell:nth-child(25),
.sudoku-cell:nth-child(26),
.sudoku-cell:nth-child(27),
.sudoku-cell:nth-child(46),
.sudoku-cell:nth-child(47),
.sudoku-cell:nth-child(48),
.sudoku-cell:nth-child(49),
.sudoku-cell:nth-child(50),
.sudoku-cell:nth-child(51),
.sudoku-cell:nth-child(52),
.sudoku-cell:nth-child(53),
.sudoku-cell:nth-child(54) {
    border-bottom: 2px solid #333;
}
/* Controls */
#controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 20px auto;
}

#number-buttons {
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.number-button {
    background-color: #007bff;
    color: #fff;
    border: none;
    padding: 10px;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.2em;
    cursor: pointer;
}

.number-button:hover {
    background-color: #0056b3;
}

#action-buttons {
    display: flex;
    justify-content: space-evenly;
    gap: 20px;
    margin-bottom: 20px;
    width: 100%;
}

#action-buttons button {
    background-color: #f8f9fa;
    border: 1px solid #ccc;
    padding: 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.2em;
}

#action-buttons button:hover {
    background-color: #e2e6ea;
}
/* popup-confirm styles */
popup-confirm {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    visibility: hidden;
    opacity: 0;
    transition: visibility 0s, opacity 0.3s;
}
popup-confirm .popup-box {
    background-color: #fff;
    padding: 20px;
    border-radius: 5px;
    text-align: center;
}
erase-button, notes-button, hint-button, undo-button {
    background-color: #f8f9fa;
    border: 1px solid #ccc;
    padding: 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.2em;
}
confirm-new-game {
    background-color: #28a745;
    border: none;
    color: #fff;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.2em;
}
cancel-new-game {
    background-color: #dc3545;
    border: none;
    color: #fff;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.2em;
}
new-game-button,acknowledge-mistake {
    background-color: #007bff;
    border: none;
    color: #fff;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.2em;
}
timer-display{
    display: flex;
    flex-wrap: wrap; /* Allows items to flow onto new lines */
}
timer-display span{
     /* The core logic: ensures exactly two items fit per row */
    flex-basis: calc(50% - 0.5rem); /* 50% width minus half the gap size */
    flex-grow: 0;                   /* Prevents items from growing into the remaining space if only one item is on the last row */
    
}
timer-display button{
    background: none;
    border: none;
    font-size: 1.2em;
    cursor: pointer;
    min-width: 2.5rem;
}
.difficulty-select {
    padding: 4px;
    font-size: 1rem;
}
.difficulty-label {
    font-weight: bold;
    margin-right: 8px;
}
.filled-cell{
    background-color: #f0f0f0;
    color: #888;
    cursor: not-allowed;
}

@media screen and (max-width: 600px) {
    :root{
        --cell-size: calc(81vw/ 9);
    }
    main{
        min-width: 16rem;
    }
}