body {
    font-family: sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: #f0f0f0;
    margin: 0;
    padding: 20px;
}

h1 {
    color: #333;
}

#game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    margin-top: 20px;
}

#board {
    display: grid;
    grid-template-columns: repeat(9, 60px);
    grid-template-rows: repeat(9, 60px);
    width: 540px;
    height: 540px;
    border: 3px solid #000;
}

.cell {
    width: 60px;
    height: 60px;
    font-size: 28.8px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    background-color: #fff;
    border: 1px solid #ccc;
    box-sizing: border-box;
    position: relative;
}

/* Estil per al color i alineació del número principal */
.main-number {
    color: #123456; /* Blau fosc */
    font-weight: bold;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
}

/* Estils per al modo notes (sense canvis) */
.notes {
    display: none; /* Amagat per defecte */
}

.cell.notes-mode .notes {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    width: 100%;
    height: 100%;
    font-size: 10.8px;
    color: #888;
    padding: 2px;
}

.notes-mode .main-number {
    display: none;
}

.cell .notes span {
    display: flex;
    justify-content: center;
    align-items: center;
    user-select: none;
}
.cell .notes span.note-1 { grid-area: 1 / 1; }
.cell .notes span.note-2 { grid-area: 1 / 2; }
.cell .notes span.note-3 { grid-area: 1 / 3; }
.cell .notes span.note-4 { grid-area: 2 / 1; }
.cell .notes span.note-5 { grid-area: 2 / 2; }
.cell .notes span.note-6 { grid-area: 2 / 3; }
.cell .notes span.note-7 { grid-area: 3 / 1; }
.cell .notes span.note-8 { grid-area: 3 / 2; }
.cell .notes span.note-9 { grid-area: 3 / 3; }

/* Bordes més gruixuts per a les línies de 3x3 */
.cell:nth-child(n+28):nth-child(-n+36),
.cell:nth-child(n+55):nth-child(-n+63) {
    border-top: 2px solid #000;
}

.cell:nth-child(3n + 1):not(:nth-child(9n+1)) {
    border-left: 2px solid #000;
}

/* Estils de les celdas */
.given {
    background-color: #e0e0e0;
    cursor: default;
    font-weight: bold;
}

.selected {
    background-color: #a0c0e0;
}

.error {
    background-color: #ff6666;
    color: #fff;
}

/* Nou estil per als controls de números en horitzontal */
#numbers {
    display: flex;
    justify-content: center;
    gap: 10px;
    width: 100%;
    max-width: 540px;
    margin-top: 20px;
}

.number-btn {
    width: 60px;
    height: 60px;
    font-size: 28.8px;
    cursor: pointer;
    border: 1px solid #ccc;
    background-color: #fff;
}

#notes-btn.active {
    background-color: #a0c0e0;
}

#difficulty-selector, #status {
    margin-top: 10px;
}

#controls {
    margin-top: 20px;
    display: flex;
    gap: 10px;
}

button {
    padding: 10px 20px;
    font-size: 16px;
    cursor: pointer;
    border: 1px solid #ccc;
    background-color: #fff;
}


/* Adaptació responsive per a pantalles petites */
@media (max-width: 600px) {
    #board {
        grid-template-columns: repeat(9, 35px);
        grid-template-rows: repeat(9, 35px);
        width: 315px; /* 9 * 35px */
        height: 315px;
    }

    .cell {
        width: 35px;
        height: 35px;
        font-size: 18px;
    }

    .cell.notes-mode .notes, .cell .notes {
        font-size: 7px;
    }

    #numbers {
        flex-wrap: wrap;
        width: 315px;
        justify-content: space-between;
    }

    .number-btn {
        width: 30px;
        height: 30px;
        font-size: 16px;
    }

    #controls button {
        padding: 8px 12px;
        font-size: 14px;
    }
}
