.sudoku-board {
    width: 100%;
    display: flex;
    max-width: 500px;
    border-radius: 12px;
    aspect-ratio: 1 / 1;
    flex-direction: column;
    border: 3px solid var(--dark);
    box-shadow: 0 4px 20px var(--shadow);
    overflow: hidden;
    background: var(--light-tertiary);
}

.sudoku-board div {
    flex: 1;
    cursor: pointer;
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: content-box;
    width: 100%;
    transition: background 0.12s ease;
}

.sudoku-board div:hover:not(.locked) {
    background: rgba(37, 99, 235, 0.07);
}

/* Your own entries render in the brand colour to read apart from givens. */
.sudoku-board div:not(.locked) {
    color: var(--primary);
    font-weight: 700;
}

/* Given clues: shaded + bold near-black, the conventional printed-Sudoku
   look. Scoped to the board so it wins over .cell / .sudoku-board div. */
.sudoku-board .locked {
    background: #dbe4f0;
    font-weight: 800;
    color: #0f172a;
    pointer-events: none;
}

.cell {
    border-bottom: 1px solid rgba(0,0,0,0.1);
    border-right: 1px solid rgba(0,0,0,0.1);
    aspect-ratio: 1 / 1;
    background: var(--light);
}

.mistake {
    position: relative;
}

.mistake::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: 0;
    width: 25%;
    height: 25%;
    background: var(--accent-red);
    clip-path: polygon(100% 0, 0 100%, 100% 100%);
}

.hint {
    background: rgba(16, 185, 129, 0.18) !important;
    transition: background 0.3s ease;
}

.subgrid-border-left   { border-left:   2px solid var(--dark); }
.subgrid-border-right  { border-right:  2px solid var(--dark); }
.subgrid-border-top    { border-top:    2px solid var(--dark); }
.subgrid-border-bottom { border-bottom: 2px solid var(--dark); }

.sudoku-digits {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin: 28px auto 0;
    padding: 0;
}

.sudoku-digits div {
    cursor: pointer;
    width: 100%;
    max-width: 56px;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    color: white;
    background: var(--primary);
    border: 2px solid var(--primary-dark);
    border-radius: 10px;
    font-size: 1.5rem;
    font-weight: 700;
    font-family: 'Orbitron', monospace;
    text-align: center;
    box-shadow: 0 3px 8px rgba(37,99,235,0.25);
    transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.sudoku-digits div:hover {
    background: var(--primary-dark);
    transform: translateY(-2px) scale(1.07);
    box-shadow: 0 6px 16px rgba(37,99,235,0.35);
}

.sudoku-digits div:active {
    transform: scale(0.95);
    box-shadow: 0 1px 4px rgba(37,99,235,0.2);
}

.sudoku-digits div.selected {
    background: var(--accent);
    border-color: #d97706;
    box-shadow: 0 0 0 3px rgba(245,158,11,0.3), 0 3px 8px rgba(245,158,11,0.25);
}

@media (max-width: 768px) {
    .sudoku-board div { font-size: 1.25rem; }
    .sudoku-digits div { font-size: 1.25rem; max-width: 48px; }
}

@media (max-width: 480px) {
    .sudoku-board div { font-size: 1rem; }
    .sudoku-digits div { font-size: 1rem; max-width: 40px; border-radius: 8px; }
}
