body {
    align-items: flex-start;
}

/* Size selector */
.size-selector {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.size-btn {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    padding: 0.5rem 1.5rem;
    border-radius: 2rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Outfit', sans-serif;
}

.size-btn.active,
.size-btn:hover {
    background: var(--primary-color);
    color: white;
}

.hint-selector {
    margin-top: -1rem;
}

/* Grid */
.grid-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
}

#grid {
    display: grid;
    border: 2px solid #475569;
    border-radius: 4px;
    overflow: hidden;
    box-sizing: content-box;
}

#grid.grid-4 {
    grid-template-columns: repeat(4, 64px);
    grid-template-rows: repeat(4, 64px);
}

#grid.grid-6 {
    grid-template-columns: repeat(6, 56px);
    grid-template-rows: repeat(6, 56px);
}

.cell {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    background: white;
    cursor: pointer;
    user-select: none;
    border-right: 1px solid #cbd5e1;
    border-bottom: 1px solid #cbd5e1;
    box-sizing: border-box;
    transition: background 0.12s;
    color: var(--text-color);
}

/* Remove outer edges */
#grid.grid-4 .cell[data-col="3"],
#grid.grid-6 .cell[data-col="5"] { border-right: none; }
#grid.grid-4 .cell[data-row="3"],
#grid.grid-6 .cell[data-row="5"] { border-bottom: none; }

/* Box dividers — 4×4 (2×2 boxes) */
#grid.grid-4 .cell[data-col="1"] { border-right: 2px solid #475569; }
#grid.grid-4 .cell[data-row="1"] { border-bottom: 2px solid #475569; }

/* Box dividers — 6×6 (2×3 boxes) */
#grid.grid-6 .cell[data-col="2"] { border-right: 2px solid #475569; }
#grid.grid-6 .cell[data-row="1"],
#grid.grid-6 .cell[data-row="3"] { border-bottom: 2px solid #475569; }

/* Cell states */
.cell.fixed {
    color: var(--primary-color);
    cursor: default;
}

.cell:not(.fixed) {
    font-size: 1.7rem;
}

.cell.selected {
    background: #3730a3;
    color: white;
}

.cell.highlight {
    background: #bfdbfe;
}

.cell.same-num {
    background: #ede9fe;
}

.cell.error {
    background: #fee2e2;
    color: #dc2626;
}

.cell.fixed.error {
    color: var(--primary-color);
    background: white;
}

/* Numpad */
.numpad {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

#numpad.numpad-4 { width: 260px; margin-left: auto; margin-right: auto; }
#numpad.numpad-6 { width: 340px; margin-left: auto; margin-right: auto; }

#numpad.numpad-4 .num-btn,
#numpad.numpad-6 .num-btn { flex: 1; width: auto; }

.num-btn {
    width: 52px;
    height: 52px;
    border-radius: 0.75rem;
    border: 2px solid #e2e8f0;
    background: white;
    color: var(--text-color);
    font-size: 1.2rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.num-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: #eef2ff;
}

.num-btn.delete {
    color: var(--accent-color);
    border-color: #fecaca;
}

.num-btn.delete:hover {
    border-color: var(--accent-color);
    background: #fee2e2;
}

/* Game controls */
.game-controls {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.game-btn {
    background: transparent;
    border: 1px solid #e2e8f0;
    color: var(--muted-text);
    padding: 0.5rem 1.5rem;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
}

.game-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* Result */
.result {
    text-align: center;
    padding: 1.25rem;
    border-radius: 1rem;
    margin-bottom: 1.5rem;
    font-weight: 700;
    font-size: 1.1rem;
    animation: fadeUp 0.5s ease;
}

.result.success {
    background: #d1fae5;
    color: #065f46;
    border: 2px solid #a7f3d0;
}

.hidden {
    display: none;
}

/* Mobile */
@media (max-width: 480px) {
    #grid.grid-4 {
        grid-template-columns: repeat(4, 60px);
        grid-template-rows: repeat(4, 60px);
    }
    #grid.grid-6 {
        grid-template-columns: repeat(6, 46px);
        grid-template-rows: repeat(6, 46px);
    }
    .cell {
        font-size: 1.2rem;
    }
    .num-btn {
        width: 46px;
        height: 46px;
        font-size: 1.1rem;
    }
    #numpad.numpad-4 { width: 244px; }
    #numpad.numpad-6 { width: 280px; }
}
