/* Sudoku Grid */
.sudoku-grid {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    width: 450px;
    max-width: 100%;
    aspect-ratio: 1;
    border: 3px solid #1e293b;
    background: #1e293b;
    gap: 1px;
    position: relative;
}

/* Thicker borders for 3x3 boxes */
.sudoku-grid::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 2;
    border: 3px solid #1e293b;
    background:
        linear-gradient(to right, transparent 33.2%, #1e293b 33.2%, #1e293b 33.6%, transparent 33.6%,
                                  transparent 66.4%, #1e293b 66.4%, #1e293b 66.8%, transparent 66.8%),
        linear-gradient(to bottom, transparent 33.2%, #1e293b 33.2%, #1e293b 33.6%, transparent 33.6%,
                                   transparent 66.4%, #1e293b 66.4%, #1e293b 66.8%, transparent 66.8%);
}

/* Cell */
.sudoku-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    font-size: 1.5rem;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.1s;
    position: relative;
}

.sudoku-cell:hover {
    background: #eef2ff;
}

.sudoku-cell.selected {
    background: #c7d2fe;
}

.sudoku-cell.highlighted {
    background: #e0e7ff;
}

.sudoku-cell.given {
    font-weight: 700;
    color: #1e293b;
    cursor: default;
}

.sudoku-cell.user-value {
    color: #4338ca;
}

.sudoku-cell.error {
    background: #fecaca;
    color: #dc2626;
}

.sudoku-cell.hint-cell {
    background: #fef3c7;
    animation: hint-flash 0.6s ease;
}

@keyframes hint-flash {
    0%, 100% { background: #fef3c7; }
    50% { background: #fbbf24; }
}

/* Mistake flash */
.sudoku-cell.mistake-flash {
    animation: mistake-flash 0.5s ease;
}

@keyframes mistake-flash {
    0% { background: #fecaca; }
    50% { background: #f87171; }
    100% { background: #fecaca; }
}

/* Pencil marks - 3x3 mini-grid inside the cell */
.pencil-marks {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    width: 100%;
    height: 100%;
    position: absolute;
    inset: 0;
}

.pencil-mark {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    color: #6b7280;
    line-height: 1;
}

/* Pencil mode active */
#btn-pencil.pencil-active {
    background: #c7d2fe;
    border-color: #4338ca;
    color: #4338ca;
}

/* Active difficulty button */
.difficulty-btn.active-difficulty {
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.5);
}

/* Ad slot - structural only */
.ad-slot {
    min-height: 0;
    width: 100%;
}

/* Print grid table (for /daily/.../print standalone page) */
@media print {
    .ad-slot {
        display: none;
    }
}

/* Responsive */
@media (max-width: 480px) {
    .sudoku-grid {
        width: 100%;
    }

    .sudoku-cell {
        font-size: 1.1rem;
    }

    .pencil-mark {
        font-size: 0.45rem;
    }

    .num-btn {
        width: 2.2rem;
        height: 2.2rem;
        font-size: 0.9rem;
    }
}
