.sudoku-board {
    box-sizing: border-box;
    display: grid;
    max-width: min(90vw, 522px);
    margin: 0 auto 1.5rem;
    padding: 12px;
    border-radius: 1rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    position: relative;
    background: #fff;
}

/* Vonalak overlay - pontosan a grid területen */
.sudoku-board::before {
    content: '';
    position: absolute;
    top: 12px;
    left: 12px;
    right: 12px;
    bottom: 12px;
    pointer-events: none;
    z-index: 5;
}

.sudoku-9x9 {
    grid-template-columns: repeat(9, 1fr);
}

.sudoku-9x9::before {
    background:
        /* Függőleges vonalak: 3. és 6. oszlop után */
        linear-gradient(to right,
            transparent calc(33.333% - 1px),
            #4f688c calc(33.333% - 1px),
            #4f688c calc(33.333% + 1px),
            transparent calc(33.333% + 1px),
            transparent calc(66.666% - 1px),
            #4f688c calc(66.666% - 1px),
            #4f688c calc(66.666% + 1px),
            transparent calc(66.666% + 1px)),
        /* Vízszintes vonalak: 3. és 6. sor után */
        linear-gradient(to bottom,
            transparent calc(33.333% - 1px),
            #4f688c calc(33.333% - 1px),
            #4f688c calc(33.333% + 1px),
            transparent calc(33.333% + 1px),
            transparent calc(66.666% - 1px),
            #4f688c calc(66.666% - 1px),
            #4f688c calc(66.666% + 1px),
            transparent calc(66.666% + 1px));
}

.sudoku-6x6 {
    grid-template-columns: repeat(6, 1fr);
}

.sudoku-6x6::before {
    background:
        /* Függőleges vonal: 3. oszlop után (50%) */
        linear-gradient(to right,
            transparent calc(50% - 1px),
            #4f688c calc(50% - 1px),
            #4f688c calc(50% + 1px),
            transparent calc(50% + 1px)),
        /* Vízszintes vonalak: 2. és 4. sor után (33.333%, 66.666%) */
        linear-gradient(to bottom,
            transparent calc(33.333% - 1px),
            #4f688c calc(33.333% - 1px),
            #4f688c calc(33.333% + 1px),
            transparent calc(33.333% + 1px),
            transparent calc(66.666% - 1px),
            #4f688c calc(66.666% - 1px),
            #4f688c calc(66.666% + 1px),
            transparent calc(66.666% + 1px));
}

.sudoku-4x4 {
    grid-template-columns: repeat(4, 1fr);
}

.sudoku-4x4::before {
    background:
        /* Függőleges vonal: 2. oszlop után (50%) */
        linear-gradient(to right,
            transparent calc(50% - 1px),
            #4f688c calc(50% - 1px),
            #4f688c calc(50% + 1px),
            transparent calc(50% + 1px)),
        /* Vízszintes vonal: 2. sor után (50%) */
        linear-gradient(to bottom,
            transparent calc(50% - 1px),
            #4f688c calc(50% - 1px),
            #4f688c calc(50% + 1px),
            transparent calc(50% + 1px));
}

.sudoku-3x3 {
    grid-template-columns: repeat(3, 1fr);
}

.sudoku-3x3::before {
    display: none;
}

.sudoku-cell {
    position: relative;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0;
    user-select: none;
    transition: all 0.15s ease;
    background: #fff;
    border: 1px dashed #cbd5e1;
}

.sudoku-cell.prefilled {
    background: #f1f5f9;
    cursor: default;
}

.sudoku-cell.drag-over {
    background: rgba(134, 239, 172, 0.4);
    border-color: #22c55e;
    transform: scale(1.05);
    z-index: 20;
}

.sudoku-cell.error {
    animation: cell-error 0.4s ease-in-out;
    border-color: #ef4444;
}

@keyframes cell-error {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-4px);
    }

    75% {
        transform: translateX(4px);
    }
}

.sudoku-image {
    width: 70%;
    height: 70%;
    object-fit: contain;
}

.sudoku-tray {
    box-sizing: border-box;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
     
    max-width: min(90vw, 522px);
    margin: 0 auto 1.5rem;
}

.sudoku-tray-item {
    width: clamp(48px, 12vw, 76px);
    height: clamp(48px, 12vw, 76px);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    transition: all 0.2s ease;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.sudoku-tray-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.sudoku-tray-image {
    width: 65%;
    height: 65%;
    object-fit: contain;
}

.sudoku-controls {
   text-align: center; margin-bottom: 1rem;
}